Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
a(0)=1. a(n) = a(n-1) + (number of earlier terms {i.e., terms a(0) through a(n-1)} that divide n).
2

%I #24 Jan 29 2019 02:16:25

%S 1,2,4,5,8,10,12,13,17,18,22,23,27,29,31,33,37,39,42,43,48,49,52,54,

%T 59,61,64,66,69,71,75,77,81,83,86,88,93,95,97,100,106,107,110,112,116,

%U 118,121,122,128,130,134,136,141,142,147,149,153,154,157,159,165,167,170

%N a(0)=1. a(n) = a(n-1) + (number of earlier terms {i.e., terms a(0) through a(n-1)} that divide n).

%H A.H.M. Smeets, <a href="/A123886/b123886.txt">Table of n, a(n) for n = 0..20000</a>

%e Among terms a(0) through a(5) there are two terms that divide 6: a(0)=1, a(1)=2. So a(6) = a(5) + 2 = 12.

%p A123886 := proc(maxn) local a,nexta,n,i ; a := [1] ; for n from 2 to maxn do nexta := op(n-1,a) ; for i from 1 to n-1 do if (n-1) mod op(i,a) = 0 then nexta := nexta +1 ; fi ; od ; a := [op(a), nexta] ; od ; RETURN(a) ; end: maxn := 100 : alist := A123886(maxn) : for i from 1 to maxn do printf("%d,",op(i,alist)) ; end : # _R. J. Mathar_, Oct 21 2006

%t f[l_List] := Append[l, Last[l] + Length[Select[l, Mod[Length[l], # ] == 0 &]]];Nest[f, {1}, 63] (* _Ray Chandler_, Oct 19 2006 *)

%o (Python)

%o a, an, la = [1], 1, 1

%o print(la-1,an)

%o while la < 63:

%o ....dc, di = 0, 0

%o ....while di < la:

%o ........if la%a[di] == 0:

%o ............dc = dc+1

%o ........di = di+1

%o ....an = an+dc

%o ....la, a = la+1, a+[an]

%o ....print(la-1,an) # _A.H.M. Smeets_, Jan 25 2019

%Y Cf. A123885.

%K easy,nonn

%O 0,2

%A _Leroy Quet_, Oct 17 2006

%E Extended by _Ray Chandler_, Oct 19 2006

%E More terms from _R. J. Mathar_, Oct 21 2006