A374235 a(n) is the least number k such that A071866(k) = n, or -1 if no such k exists.
1, 2, 4, 68, 46, 221, 757, 5518, 65106, 1293698, 3997147, 4009564363
Offset: 2
Crossrefs
Cf. A071866.
Programs
-
Mathematica
seq[len_, max_] := Module[{s = Table[0, len], p1 = 2, c = 0, k = 1, i}, While[c < len && p1 < max, p2 = NextPrime[p1]; i = Length[ContinuedFraction[p2/p1]] - 1; If[i <= len && s[[i]] == 0, c++; s[[i]] = k]; p1 = p2; k++]; s]; seq[9, 10^7]
-
PARI
seq(len, pmax = oo) = {my(s = vector(len), p1 = 2, c = 0, k = 1, i); while(c < len && p1 < pmax, p2 = nextprime(p1+1); i = length(contfrac(p2/p1)) - 1; if(i <= len && s[i] == 0, c++; s[i] = k); p1 = p2; k++); s;}
Comments