A064418 a(1) = 1, a(2) = 2, a(3) = 3, a(4) = 4; for n > 4, a(n) = smallest number not already used such that gcd(a(n), a(n-1)) >= 4.
1, 2, 3, 4, 8, 12, 6, 18, 9, 27, 36, 16, 20, 5, 10, 15, 25, 30, 24, 28, 7, 14, 21, 35, 40, 32, 44, 11, 22, 33, 55, 45, 50, 60, 42, 48, 52, 13, 26, 39, 65, 70, 49, 56, 63, 54, 66, 72, 64, 68, 17, 34, 51, 85, 75, 80, 76, 19, 38, 57, 95, 90, 78, 84, 77, 88, 92, 23, 46, 69, 115, 100, 96
Offset: 1
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
- J. C. Lagarias, E. M. Rains and N. J. A. Sloane, The EKG sequence, Exper. Math. 11 (2002), 437-446.
- Index entries for sequences related to EKG sequence
- Index entries for sequences that are permutations of the natural numbers
Programs
-
Haskell
import Data.List (delete) a064418 n = a064418_list !! (n-1) a064418_list = 1 : 2 : 3 : 4 : (f 4 [5..]) where f :: Integer -> [Integer] -> [Integer] f x xs = m : (f m $ delete m xs) where m = head $ dropWhile ((< 4) . (gcd x)) xs -- Reinhard Zumkeller, Feb 20 2011
-
Mathematica
A064418 = Range[4]; Do[ For[ an=5, True, an++, If[GCD[an, Last[A064418]] >= 4 && FreeQ[A064418, an], AppendTo[A064418, an]; Break[]]], {70}]; A064418 (* Jean-François Alcover, May 07 2012 *)
Extensions
More terms from Naohiro Nomoto, Sep 30 2001
Comments