OFFSET
1,1
COMMENTS
In the sieve of Eratosthenes, first the even numbers are removed, then the multiples of 3, then multiples of 5. In this sieve first the numbers greater than 2 and modulo 0 or 1 (mod 4) are removed leaving (1) 2, 3, 6, 7, 10, 11, 14, 15. Then the numbers greater than 3 and modulo 0, 1, 2 (mod 9) are removed leaving (1) 2, 3, 6, 7, 14, 15. Then numbers modulo 0, 1, 2, 3, 4, 5 (mod 36) are removed.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
MAPLE
N:= 1000: # for terms <= N
R:= NULL:
Cands:= [$2..N]:
while Cands <> [] do
r:= Cands[1];
R:= R, r;
Cands:= select(t -> t mod r^2 >= r, Cands[2..-1]);
od:
R; # Robert Israel, Sep 05 2024
PROG
(Python3)
from math import sqrt
length=100
s=list(range(2, length))
for p in range(int(sqrt(length))):
x = s[p]
if x==0 : continue
for i, e in enumerate(s):
if e>x and e%(x*x)<x:
s[i]=0 # mark sieved values as zero
result =[j for j in s if j!=0] # remove zeros
print(result)
(PARI) seq(n)={my(a=vector(n), k=1); for(n=1, #a, while(1, k++; my(f=1); for(i=1, n-1, if(k%a[i]^2<a[i], f=0; break)); if(f, a[n]=k; break))); a} \\ Andrew Howroyd, Sep 12 2020
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
James Kilfiger, Sep 12 2020 (suggested by student)
EXTENSIONS
Terms a(29) and beyond from Andrew Howroyd, Sep 12 2020
STATUS
approved