|
|
A064419
|
|
a(n) = n for n <= 5; for n > 5, a(n) = smallest number not already used such that gcd(a(n), a(n-1)) >= 5.
|
|
3
|
|
|
1, 2, 3, 4, 5, 10, 15, 20, 25, 30, 6, 12, 18, 9, 27, 36, 24, 8, 16, 32, 40, 35, 7, 14, 21, 28, 42, 48, 54, 45, 50, 55, 11, 22, 33, 44, 66, 60, 65, 13, 26, 39, 52, 78, 72, 56, 49, 63, 70, 75, 80, 64, 88, 77, 84, 90, 81, 99, 108, 96, 102, 17, 34, 51, 68, 85, 95, 19, 38, 57, 76, 114, 120
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
A permutation of the natural numbers.
|
|
LINKS
|
J. C. Lagarias, E. M. Rains and N. J. A. Sloane, The EKG sequence, Exper. Math. 11 (2002), 437-446.
|
|
MATHEMATICA
|
Module[{gcdlist=Range[5], k}, Do[k=6; While[GCD[k, Last[gcdlist]]<5 || MemberQ[ gcdlist, k], k++]; AppendTo[gcdlist, k]; , {80}]; gcdlist] (* Harvey P. Dale, Apr 11 2012 *)
|
|
PROG
|
(Haskell)
a064419 n = a064419_list !! (n-1)
a064419_list = [1, 2, 3, 4, 5] ++ f 5 [] [6..] where
f z xs (y:ys) | y `gcd` z > 4 = y : f y [] (reverse xs ++ ys)
| otherwise = f z (y:xs) ys
(Python)
from sympy import gcd
l=list(range(1, 6))
for n in range(5, 101):
k=6
while k in l or gcd(l[n - 1], k)<5: k+=1
l.append(k)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,nice,easy
|
|
AUTHOR
|
Jonathan Ayres (Jonathan.ayres(AT)btinternet.com), Sep 30 2001
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|