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.

A382951 Sequence of positive integers with no repetitions and, when put in a spiral, all lines (straight or diagonal) are pairwise coprime.

Original entry on oeis.org

1, 2, 3, 5, 4, 7, 11, 9, 13, 17, 19, 23, 8, 29, 31, 27, 25, 37, 39, 16, 41, 43, 14, 47, 33, 53, 35, 59, 61, 67, 71, 73, 49, 79, 83, 89, 97, 101, 103, 55, 107, 109, 91, 113, 85, 127, 131, 137, 139, 121, 149, 151, 157, 133, 163, 65, 167, 51, 125, 173, 143, 179, 181, 191, 161, 22, 193, 169, 197, 199, 211
Offset: 1

Views

Author

Bryle Morga, Apr 09 2025

Keywords

Comments

We take the lexicographically earliest sequence that fits the name.
It seems likely (but unproven) that every positive integers appear and that this sequence is a permutation of the positive integers. Some number just takes very long to appear. For instance, here are the number of steps it took to reach some numbers:
6: 160 steps
10: 468 steps
12: 571 steps
15: 4048 steps!!
18: 582 steps
20: 1492 steps
21: 820 steps
It takes at least floor(N/2)^2 steps before the first N integers appear. Any tighter bound?

Examples

			    4 -- 5 -- 3
    |         |
    7    1 -- 2
    |
   11 --
.
Look at the 7th term. It couldn't be 1, 2, 3, 4, 5, and 7 as they already occurred in the sequence. It also can't be 6, 8, or 10 because they all share factors with 4 which is in the vertical line (...4, 7, 11...). It cannot be a 9 because of the diagonal (...11, 1, 3...).
		

Crossrefs

Cf. A336349.

Programs

  • Mathematica
    S[n_]:=Block[{v,sq={1}, p=Most[{Re@#, Im@#}&/@ Fold[Join[#1, Last[#1]+I^#2 Range[#2/2]]&, {0}, Range[4n+2]]], A=<||>, T=<||>, s, d=Rest@ Tuples[{0,1,-1}, 2]}, T[1]=1; A[{0,0}]=1; s[z_]:=Block[{L={},o}, Do[o=z; While[ Max[Abs[o+e]]<=n, AppendTo[L,o+=e]],{e,d}];L]; Do[v=LCM@@ A/@ Intersection[Keys[A], s[u]]; k=2; While[ KeyExistsQ[T,k] || GCD[v,k]>1,k++]; AppendTo[sq,k]; T[k]=1; A[u]=k, {u, Rest@p}]; (* Print@ Graphics@ Table[ Text[sq[[i]], p[[i]]], {i,Length[p]}]; *) sq]; S[4] (* S[n] returns the values for a grid of semidiameter n. Uncomment the Print to show the spiral. Giovanni Resta, Apr 10 2025 *)