Ask Your Question

Revision history [back]

Hello,

If you just want to iterate through these number then you can do

sage: N_max = 1000
sage: for N in srange(23, N_max, 24):
....:    if not N.is_squarefree():
....:        continue
....:    # here N is square free = -1 (24)
....:    print N

And you get as output

23
47
71
95
119
...
959
983

You can also create the list of such integers with

sage: l = [N for N in srange(23, N_max, 24) if N.is_squarefree()]

Then

sage: print l[0], l[1], l[2]
23 47 71

Vincent