cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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).

This page as a plain text file.
%I A240024 #15 Feb 16 2025 08:33:21
%S A240024 1,4,6,8,10,12,9,15,18,14,16,20,22,24,21,27,30,25,35,28,26,32,34,36,
%T A240024 33,39,42,38,40,44,46,48,45,50,52,54,51,57,60,55,65,70,49,56,58,62,64,
%U A240024 66,63,69,72,68,74,76,78,75,80,82,84,77,88,86,90,81,87,93
%N 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).
%C A240024 A239965 gives the position of the n-th nonprime; a(A239965(n))=A018252(n).
%H A240024 Reinhard Zumkeller, <a href="/A240024/b240024.txt">Table of n, a(n) for n = 1..10000</a>
%H A240024 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/EKGSequence.html">EKG Sequence</a>
%H A240024 <a href="/index/Ed#EKG">Index entries for sequences related to EKG sequence</a>
%t A240024 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 *)
%o A240024 (Haskell)
%o A240024 import Data.List (delete, genericIndex)
%o A240024 a240024 n = genericIndex a240024_list (n - 1)
%o A240024 a240024_list = 1 : ekg 4 a002808_list where
%o A240024    ekg x zs = f zs where
%o A240024        f (y:ys) = if gcd x y > 1 then y : ekg y (delete y zs) else f ys
%Y A240024 Cf. A064413, A064664 (EKG sequence).
%Y A240024 Cf. A018252, A075570, A239965.
%K A240024 nonn
%O A240024 1,2
%A A240024 _Reinhard Zumkeller_, Apr 30 2014