login
A240024
Nonprime EKG sequence, cf. A064413: a(1) = 1, a(2) = 4 and for n > 2, a(n) = smallest composite number not already used which shares a factor with a(n-1).
9
1, 4, 6, 8, 10, 12, 9, 15, 18, 14, 16, 20, 22, 24, 21, 27, 30, 25, 35, 28, 26, 32, 34, 36, 33, 39, 42, 38, 40, 44, 46, 48, 45, 50, 52, 54, 51, 57, 60, 55, 65, 70, 49, 56, 58, 62, 64, 66, 63, 69, 72, 68, 74, 76, 78, 75, 80, 82, 84, 77, 88, 86, 90, 81, 87, 93
OFFSET
1,2
COMMENTS
A239965 gives the position of the n-th nonprime; a(A239965(n))=A018252(n).
LINKS
MATHEMATICA
a = {1, 4}; Do[k = 6; While[Or[PrimeQ@ k, MemberQ[a, k], CoprimeQ[a[[i - 1]], k]], k++]; AppendTo[a, k], {i, 3, 66}]; a (* Michael De Vlieger, Sep 01 2016 *)
PROG
(Haskell)
import Data.List (delete, genericIndex)
a240024 n = genericIndex a240024_list (n - 1)
a240024_list = 1 : ekg 4 a002808_list where
ekg x zs = f zs where
f (y:ys) = if gcd x y > 1 then y : ekg y (delete y zs) else f ys
CROSSREFS
Cf. A064413, A064664 (EKG sequence).
Sequence in context: A284913 A139203 A179372 * A227405 A061408 A063287
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Apr 30 2014
STATUS
approved