|
|
A354790
|
|
a(n) is the least positive squarefree number not already used that is coprime to the previous floor(n/2) terms.
|
|
10
|
|
|
1, 2, 3, 5, 7, 11, 6, 13, 17, 19, 23, 29, 31, 35, 22, 37, 39, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 85, 89, 14, 97, 101, 103, 33, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 65, 233
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
A version of the Two-Up sequence A090252 that is restricted to squarefree numbers.
|
|
LINKS
|
Thomas Scheuerle, Comments on A354790 regarding the possibility of composites with more than two factors.
|
|
MAPLE
|
# This produces 2*M terms in the array a
# Assumes b117 is a list of sufficiently many squarefree numbers A005117
# Test if u is relatively prime to all of a[i], i = i1..i2
perpq:=proc(u, i1, i2) local i; global a;
for i from i1 to i2 do if igcd(u, a[i])>1 then return(-1); fi; od: 1; end;
a:=Array(1..10000, -1);
hit:=Array(1..10000, -1); # 1 if i has appeared
a[1]:=1; a[2]:=2; hit[1]:=1; hit[2]:=1;
M:=100; M1 := 1000;
for p from 2 to M do
# step 1 want a[2p-1] relatively prime to a[p] ... a[2p-2]
sw1:=-1;
for j from 1 to M1 do
c:=b117[j];
if hit[c] = -1 and perpq(c, p, 2*p-2) = 1 then a[2*p-1]:=c; hit[c]:=1; sw1:=1; break; fi;
od: # od j
if sw1 = -1 then error("no luck, step 1, p =", p ); fi;
# step 2 want a[2p] relatively prime to a[p] ... a[2p-1]
sw2:=-1;
for j from 1 to M1 do
c:=b117[j];
if hit[c] = -1 and perpq(c, p, 2*p-1) = 1 then a[2*p]:=c; hit[c]:=1; sw2:=1; break; fi;
od: # od j
if sw2 = -1 then error("no luck, step 2, p =", p ); fi;
od: # od p
[seq(a[i], i=1..2*M)];
|
|
MATHEMATICA
|
nn = 60; pp[_] = 1; k = r = 1; c[_] = False; a[1] = 1; Do[Set[m, SelectFirst[Union@ Append[Times @@ # & /@ Subsets[#, {2, Infinity}], Prime[r]] &[Prime@ Select[Range[If[k == 1, r, k + 1]], p[Prime[#]] < n &]], ! c[#] &]]; Set[a[n], m]; (c[m] = True; If[PrimeQ[m], r++]; If[n > 1, Map[(Set[p[#], 2 n]; pp[#]++) &, #]]) &@ FactorInteger[m][[All, 1]]; While[pp[Prime[k]] > 2, k++], {n, 2, nn}]; Array[a, nn] (* Michael De Vlieger, Sep 06 2022 *)
|
|
PROG
|
(PARI) See Links section.
Rémy Sigrist kindly provided the following hint for using his PARI program. To change the number of terms produced, change these three lines:
sf = select(issquarefree, [1..111 000]);
u = 1;
a = vector(10 000);
Replace 10 000 by the number of desired terms; then 111 000 must be greater than the largest term. To get 1000 terms, for example, replace 10 000 by 1000, and 111 000 by the 1000-th prime. - N. J. A. Sloane, Jul 17 2022
(Python)
from math import lcm, gcd
from itertools import count, islice
from collections import deque
from sympy import factorint
def A354790_gen(): # generator of terms
aset, aqueue, c, b, f = {1}, deque([1]), 2, 1, True
yield 1
while True:
for m in count(c):
if m not in aset and gcd(m, b) == 1 and all(map(lambda n:n<=1, factorint(m).values())):
yield m
aset.add(m)
aqueue.append(m)
if f: aqueue.popleft()
b = lcm(*aqueue)
f = not f
while c in aset:
c += 1
break
(C) See Links section.
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|