OFFSET
1,3
COMMENTS
Every nonnegative number appears here exactly once.
LINKS
J. C. Lagarias, E. M. Rains and N. J. A. Sloane, The EKG sequence, Exper. Math. 11 (2002), 437-446.
MATHEMATICA
terms = 100;
ekg[s_] := Block[{m = s[[-1]], k = 3}, While[MemberQ[s, k] || GCD[m, k] == 1, k++]; Append[s, k]];
EKG = Nest[ekg, {2, 4}, 2 terms];
a[1] = 0; a[n_] := FirstPosition[EKG, n] // First;
Array[a, terms] (* Jean-François Alcover, Aug 30 2018, after Robert G. Wilson v *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Jonathan Ayres (Jonathan.ayres(AT)btinternet.com), Sep 30 2001
EXTENSIONS
More terms from Naohiro Nomoto, Sep 30 2001
STATUS
approved