A357839 a(n) is the greatest divisor > 1 of n which has already been listed, otherwise a(n) is the smallest number not yet listed; a(1) = 0.
0, 1, 2, 2, 3, 3, 4, 4, 3, 2, 5, 4, 6, 2, 5, 4, 7, 6, 8, 5, 7, 2, 9, 8, 5, 2, 9, 7, 10, 10, 11, 8, 11, 2, 7, 9, 12, 2, 3, 10, 13, 7, 14, 11, 9, 2, 15, 12, 7, 10, 3, 13, 16, 9, 11, 14, 3, 2, 17, 15, 18, 2, 9, 16, 13, 11, 19, 17, 3, 14, 20, 18, 21, 2, 15, 19, 11
Offset: 1
Examples
For n = 6 the set of all divisors of 6 greater than 1 is {2, 3, 6}. Also, the set of all a(n < 6) is {0, 1, 2, 3}. The greatest divisor of 6 (excluding 1) that has been listed is 3, so a(6) = 3.
Links
- Samuel Harkness, Table of n, a(n) for n = 1..10000
- Samuel Harkness, Log-log Scatterplot of the first 3000000 terms
- Samuel Harkness, Scatterplot of the first 3000000 terms
Programs
-
Mathematica
a = 0; A = {a}; Do[s = Drop[Reverse[Divisors[n]], 1]; s = Drop[s, -1]; If[Length[s] >= 1, Do[If[MemberQ[A, Part[s, d]], AppendTo[A, Part[s, d]]; Break[]], {d, 1, Length[s]}], a++; AppendTo[A, a]], {n, 2, 77}] Print[A]
-
PARI
first(n)=my(v=vector(n),m); forfactored(k=2,n, v[k[1]]=if(vecsum(k[2][,2])==1, m++, my(t); fordiv(k,d, if(d<=m, t=d)); t)); v \\ Charles R Greathouse IV, Oct 14 2022
Comments