OFFSET
1,2
COMMENTS
LINKS
Ray Chandler, Table of n, a(n) for n = 1..10000 (first 1000 terms from T. D. Noe)
J. C. Lagarias, E. M. Rains, and N. J. A. Sloane, The EKG sequence, Exper. Math. 11 (2002), 437-446; arXiv preprint, arXiv:math/0204011 [math.NT], 2002.
Eric Weisstein's World of Mathematics, EKG Sequence.
EXAMPLE
Original permutation has cycles (1) (2) (3, 4, 6, 9, 10, 5) (..., 20, 18, 12, 7, 14, 13, 28, 26, ...) (8) ...
MATHEMATICA
maxN=200; lst={1, 2}; unused=Range[3, maxN]; found=True; While[found, found=False; i=0; While[ !found&&i<Length[unused], i++; If[GCD[lst[[ -1]], unused[[i]]]>1, found=True; AppendTo[lst, unused[[i]]]; unused=Delete[unused, i]]]]; Take[Ordering[lst], unused[[1]]-1]
PROG
(Haskell)
import Data.List (elemIndex); import Data.Maybe (fromJust)
a064664 = (+ 1) . fromJust . (`elemIndex` a064413_list)
-- Reinhard Zumkeller, May 01 2014, Sep 17 2011
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Oct 11 2001
STATUS
approved