OFFSET
0,2
LINKS
Lei Zhou, Table of n, a(n) for n = 0..10000
EXAMPLE
MATHEMATICA
NumDiff[n1_, n2_] := Module[{c1 = n1, c2 = n2}, If[c1 < c2, c1 = c1 + c2; c2 = c1 - c2; c1 = c1 - c2];
k = Floor[c1/c2]; a1 = c1 - k*c2; If[a1 == 0, a2 = 0, a2 = (k + 1) c2 - c1]; Return[Min[a1, a2]]];
a = {1}; n = 0; p1 = 2; p2 = 1; lb = 0; While[lb < 100, n++; p2 = NextPrime[p2]; If[p2 > p1, p1 = p2; p2 = 2];
d = NumDiff[p1, p2]; While[l = Length[a]; l <= d, AppendTo[a, 0]]; If[a[[d + 1]] == 0, a[[d + 1]] = n; ps = Position[a, 0]; If[Length[ps] == 0, b = a, ps1 = ps[[1]][[1]]; b = Take[a, ps1 - 1]]; lb = Length[b]]]; b
CROSSREFS
KEYWORD
nonn
AUTHOR
Lei Zhou, Feb 02 2015
STATUS
approved