A297003 a(n) = 2^(n-1), n=1,2,3; for n >= 4, a(n) is the number of the previous terms dividing n.
1, 2, 4, 3, 1, 4, 2, 6, 3, 4, 2, 11, 2, 6, 4, 10, 2, 11, 2, 13, 4, 10, 2, 18, 2, 11, 4, 16, 2, 17, 2, 19, 7, 13, 3, 24, 2, 14, 7, 21, 2, 23, 2, 24, 5, 16, 2, 31, 4, 19, 6, 25, 2, 24, 6, 27, 7, 17, 2, 35, 2, 20, 9, 28, 5, 29, 2, 29, 6, 29, 2, 41, 2, 22, 8, 31
Offset: 1
Examples
1-3) a(1)=1, a(2)=2 a(3)=4 by the definition; 4) Let n=4. From the previous terms {1,2,4} everyone divides 4, so a(4)=3; 5) Let n=5. From the previous terms {1,2,4,3} only 1 divides 5. So a(5)=1; 6) Let n=6. From the previous terms {1,2,4,3,1} exactly four divide 6. So a(6)=4; etc.
Links
- Peter J. C. Moses, Table of n, a(n) for n = 1..10000
Crossrefs
Cf. A088167.
Programs
-
Mathematica
first[n_] := Fold[Append[#1, Count[#1, k_ /; Divisible[#2, k]]] &, 2^Range[0, Min[n - 1, 2]], Range[4, n]] (* Michael De Vlieger, Dec 23 2017 *)
-
PARI
first(n) = my(res = vector(n), c = 0); for(x = 1, min(n, 3), res[x] = 1<<(x-1)); for(x=4, n, for(k=1, x-1, if(x%res[k]==0, c++)); res[x] = c; c = 0); res \\ Iain Fox, Dec 23 2017
-
Sage
def A297003_list(leng): L = [1, 2, 4] if leng < 4: return L[0:leng] for n in (4..leng) : count = 0 for l in L: count += int(l.divides(n)) L.append(count) return L print(A297003_list(76)) # Peter Luschny, Dec 24 2017
Formula
a(p) = 2, where p is prime, other than 3 and 5.
Extensions
More terms from Peter J. C. Moses, Dec 23 2017