login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A045954 Even-Lucky-Numbers: generated by a sieve process like that for Lucky numbers but starting with even numbers. 19

%I #35 Nov 17 2022 05:15:37

%S 2,4,6,10,12,18,20,22,26,34,36,42,44,50,52,54,58,68,70,76,84,90,98,

%T 100,102,108,114,116,118,130,132,138,140,148,150,164,170,172,178,182,

%U 186,196,198,212,214,218,228,230,234,244,246,260,262,268,278,282,290,298,300,308

%N Even-Lucky-Numbers: generated by a sieve process like that for Lucky numbers but starting with even numbers.

%C Write down even numbers: 2, 4, 6, 8, ...; first term > 2 is 4 so starting from 2 remove every 4th number: 2, 4, 6, 10, 12, 14, 18, ...; next number is 6 so remove every 6th term starting from 2: 2, 4, 6, 10, 12, 18, 20, 22, 26, etc.

%H Reinhard Zumkeller, <a href="/A045954/b045954.txt">Table of n, a(n) for n = 1..1000</a>

%H <a href="/index/Si#sieve">Index entries for sequences generated by sieves</a>

%p ## Finds all Even Lucky Numbers up to n from the list 2..n.

%p ## Try n=10^5 or 10^6 just for fun!

%p evenluckynumbers:=proc(n) local k, Lnext, Lprev; Lprev:=[$2..n]; for k from 1 do Lnext:= map(w-> Lprev[w],remove(z -> z mod Lprev[k] = 0,[$1..nops(Lprev)])); if nops(Lnext)=nops(Lprev) then return Lnext fi; Lprev:=Lnext; od; end: # _Walter Kehowski_, Jun 06 2008

%t lst = Range[2, 308, 2]; i = 2; While[ i <= (len = Length@lst) && (k = lst[[i]]) <= len, lst = Drop[lst, {k, len, k}]; i++ ]; lst (* _Robert G. Wilson v_, May 11 2006 *)

%o (Haskell)

%o a045954 n = a045954_list !! (n-1)

%o a045954_list = 2 : sieve 2 [2,4..] where

%o sieve k xs = z : sieve (k + 1) (lucky xs) where

%o z = xs !! (k - 1 )

%o lucky ws = us ++ lucky vs where

%o (us, _:vs) = splitAt (z - 1) ws

%o -- _Reinhard Zumkeller_, Dec 05 2011

%Y Cf. A000959, A039672.

%K nice,nonn,easy

%O 1,1

%A _Felice Russo_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 29 02:23 EDT 2024. Contains 371264 sequences. (Running on oeis4.)