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.
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..1000
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
KEYWORD
nice,nonn,easy
AUTHOR
STATUS
approved