OFFSET
1,2
LINKS
EXAMPLE
Start with
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ... and delete every second term, giving
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 ... and delete every 3rd term, giving
1 3 7 9 13 15 19 21 25 27 ... and delete every 5th term, giving
1 3 7 9 15 19 21 25 ... and delete every 7th term, giving
.... Continue forever and what's left is the sequence.
MAPLE
S[1]:={seq(i, i=1..390)}: for n from 2 to 390 do S[n]:=S[n-1] minus {seq(S[n-1][ithprime(n-1)*i], i=1..nops(S[n-1])/ithprime(n-1))} od: S[390]; # Emeric Deutsch, Nov 17 2004
MATHEMATICA
Clear[l, ps]; ps=Prime[Range[100]]; l=Range[400]; Do[l=Drop[l, {First[ps], -1, First[ps]}]; ps=Rest[ps], {17}]; l (* Harvey P. Dale, Sep 03 2011 *)
PROG
(Python)
import sympy
from sympy import prime
def a(n):
..x = 1
..lst = []
..lst.extend(range(1, 1000))
..while x <= n:
....lst1 = []
....for i in lst:
......if (lst.index(i)+1)%prime(x)!=0:
........lst1.append(i)
....lst.clear()
....lst.extend(lst1)
....x += 1
..return lst1[n-1]
n = 1
while n < 100:
..print(a(n), end=', ')
..n += 1
# Derek Orr, Jun 16 2014
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, Nov 16 2004
EXTENSIONS
More terms from Ray Chandler, Nov 16 2004
STATUS
approved