

A108696


Generated by a sieve: see comments.


4



1, 2, 3, 5, 7, 11, 13, 19, 23, 31, 35, 43, 49, 59, 61, 79, 83, 103, 109, 119, 133, 151, 155, 175, 193, 211, 215, 241, 259, 275, 283, 323, 331, 361, 373, 403, 419, 443, 455, 499, 511, 541, 571, 613, 623, 649, 673, 719, 733, 781, 803, 841, 871, 919
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

Start with the natural numbers:
1 2 3 4 5 6 7 8 9 10 11 ...
Accept the 2nd number, 2 and erase every 2nd number after it, giving:
1 2 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 ...
Accept the 3rd number, 3 and erase every 3rd number after it, giving:
1 2 3 5 7 11 13 17 19 23 25 29 31 35 ...
Accept the 4th number, 5 and erase every 4th number after it, giving:
1 2 3 5 7 11 13 19 23 25 31 35 ...
Repeat!


LINKS

Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Index entries for sequences generated by sieves


PROG

(tcl) source /tclutils/utils.tcl
set l [range 0 10000]; set z z
for {set i 2} {$i*2 <= [llength $l]} {incr i} {
set k [expr {[llength $l]1}]
set k [expr {$k  ($k % $i)}]
while {$k > $i} {
set l [lreplace $l $k $k]
incr k $i
}
puts "after $i: length [llength $l], prefix [join [lrange $l 0 10] { }]"
}
(Haskell)
a108696 n = a108696_list !! (n1)
a108696_list = 1 : sieve' 2 [2..] where
sieve' n (x:xs) = x : (sieve' (n+1) $ sieving xs) where
sieving xs = (take (n1) xs) ++ (sieving $ drop n xs)
 Reinhard Zumkeller, Jul 04 2011


CROSSREFS

Equals A007952 + 2 or equally A002491(n) + 1.
Sequence in context: A233893 A232824 A078334 * A215642 A092581 A130807
Adjacent sequences: A108693 A108694 A108695 * A108697 A108698 A108699


KEYWORD

nonn


AUTHOR

David Applegate, Oct 11 2007


STATUS

approved



