cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A352950 Lexicographically earliest infinite sequence of distinct nonnegative integers commencing 1,3,5,7 such that any four consecutive terms are pairwise coprime.

This page as a plain text file.
%I A352950 #24 Jul 01 2025 23:33:33
%S A352950 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,
%T A352950 39,43,47,20,49,51,53,22,35,57,59,26,55,61,63,32,65,67,69,28,71,73,45,
%U A352950 34,77,79,75,38,83,89,81,40,91,97,87,44,85,101,93,46,95,103,99,52,107,109,105
%N A352950 Lexicographically earliest infinite sequence of distinct nonnegative integers commencing 1,3,5,7 such that any four consecutive terms are pairwise coprime.
%C A352950 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.
%C A352950 a(4n+5) is always even (and < a(4n+2)); n>=0.
%C A352950 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.
%C A352950 Primes p other than p = 2 appear in their natural order.
%H A352950 Michael De Vlieger, <a href="/A352950/a352950.png">Log-log scatterplot of a(n)</a>, 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.
%e A352950 3,5,7 are pairwise coprime and 2 is the smallest unused number coprime to all of them, therefore a(5)=2.
%p A352950 ina := proc(n) false end: # adapted from code for A103683
%p A352950 a := proc (n) option remember; local k;
%p A352950 if n < 5 then k := 2*n-1
%p A352950 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
%p A352950 do
%p A352950 end do
%p A352950 end if; ina(k):= true; k
%p A352950 end proc;
%p A352950 seq(a(n), n = 1 .. 100);
%t A352950 Block[{a, c, k, m, u, nn}, 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 *)
%o A352950 (Python)
%o A352950 from math import gcd
%o A352950 from itertools import islice
%o A352950 def agen(): # generator of terms
%o A352950     aset, b, c, d = {1, 3, 5, 7}, 3, 5, 7
%o A352950     yield from [1, b, c, d]
%o A352950     while True:
%o A352950         k = 1
%o A352950         while k in aset or any(gcd(t, k) != 1 for t in [b, c, d]): k+= 1
%o A352950         b, c, d = c, d, k
%o A352950         aset.add(k)
%o A352950         yield k
%o A352950 print(list(islice(agen(), 107))) # _Michael S. Branicky_, Apr 10 2022
%Y A352950 Cf. A085229, A103683, A350359.
%K A352950 nonn
%O A352950 1,2
%A A352950 _David James Sycamore_, Apr 10 2022