login
A352950
Lexicographically earliest infinite sequence of distinct nonnegative integers commencing 1,3,5,7 such that any four consecutive terms are pairwise coprime.
5
1, 3, 5, 7, 2, 9, 11, 13, 4, 15, 17, 19, 8, 21, 23, 25, 16, 27, 29, 31, 10, 33, 37, 41, 14, 39, 43, 47, 20, 49, 51, 53, 22, 35, 57, 59, 26, 55, 61, 63, 32, 65, 67, 69, 28, 71, 73, 45, 34, 77, 79, 75, 38, 83, 89, 81, 40, 91, 97, 87, 44, 85, 101, 93, 46, 95, 103, 99, 52, 107, 109, 105
OFFSET
1,2
COMMENTS
The pairwise coprime relations found in the first four odd numbers 1,3,5,7 are preserved throughout in any run of four consecutive terms.
a(4n+5) is always even (and < a(4n+2)); n>=0.
The plot exhibits two distinct rays at first (upper/odd, lower/even), with no terms divisible by 6 until a(229), at which point the even ray switches to producing just 28 multiples of 6 until a(337)=168. At this point the original even ray is re-established, the odd ray divides into two (quasi-parallel) rays, and no further multiples of 6 are seen. Therefore it seems very unlikely that the sequence is a permutation of the nonnegative integers.
Primes p other than p = 2 appear in their natural order.
LINKS
Michael De Vlieger, Log-log scatterplot of a(n), n = 1..2^14, highlighting primes in green, numbers divisible by 6 in gold, other even numbers in red, odd numbers divisible by 3 in blue.
EXAMPLE
3,5,7 are pairwise coprime and 2 is the smallest unused number coprime to all of them, therefore a(5)=2.
MAPLE
ina := proc(n) false end: # adapted from code for A103683
a := proc (n) option remember; local k;
if n < 5 then k := 2*n-1
else for k from 2 while ina(k) or igcd(k, a(n-1)) <> 1 or igcd(k, a(n-2)) <> 1 or igcd(k, a(n-3)) <> 1
do
end do
end if; ina(k):= true; k
end proc;
seq(a(n), n = 1 .. 100);
MATHEMATICA
nn = 86; c[_] = 0; MapIndexed[Set[{a[First[#2]], c[#1]}, {#1, First[#2]}] &, {1, 3, 5, 7}]; u = 2; Do[k = u; m = LCM @@ Array[a[i - #] &, 3]; While[Nand[c[k] == 0, CoprimeQ[m, k]], k++]; Set[{a[i], c[k]}, {k, i}]; If[a[i] == u, While[c[u] > 0, u++]], {i, 5, nn}]; Array[a, nn] (* Michael De Vlieger, Apr 12 2022 *)
PROG
(Python)
from math import gcd
from itertools import islice
def agen(): # generator of terms
aset, b, c, d = {1, 3, 5, 7}, 3, 5, 7
yield from [1, b, c, d]
while True:
k = 1
while k in aset or any(gcd(t, k) != 1 for t in [b, c, d]): k+= 1
b, c, d = c, d, k
aset.add(k)
yield k
print(list(islice(agen(), 107))) # Michael S. Branicky, Apr 10 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved