A382951 Sequence of positive integers with no repetitions and, when put in a spiral, all lines (straight or diagonal) are pairwise coprime.
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
Keywords
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 *)
Comments