login
A045954
Even-Lucky-Numbers: generated by a sieve process like that for Lucky numbers but starting with even numbers.
19
2, 4, 6, 10, 12, 18, 20, 22, 26, 34, 36, 42, 44, 50, 52, 54, 58, 68, 70, 76, 84, 90, 98, 100, 102, 108, 114, 116, 118, 130, 132, 138, 140, 148, 150, 164, 170, 172, 178, 182, 186, 196, 198, 212, 214, 218, 228, 230, 234, 244, 246, 260, 262, 268, 278, 282, 290, 298, 300, 308
OFFSET
1,1
COMMENTS
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.
MAPLE
## Finds all Even Lucky Numbers up to n from the list 2..n.
## Try n=10^5 or 10^6 just for fun!
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
MATHEMATICA
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 *)
PROG
(Haskell)
a045954 n = a045954_list !! (n-1)
a045954_list = 2 : sieve 2 [2, 4..] where
sieve k xs = z : sieve (k + 1) (lucky xs) where
z = xs !! (k - 1 )
lucky ws = us ++ lucky vs where
(us, _:vs) = splitAt (z - 1) ws
-- Reinhard Zumkeller, Dec 05 2011
CROSSREFS
Sequence in context: A033098 A220478 A033868 * A072542 A167856 A293750
KEYWORD
nice,nonn,easy
AUTHOR
STATUS
approved