OFFSET
1,1
COMMENTS
To ensure the sequence is infinite a(n) must be chosen so that a(n-1) mod a(n) is not 0 or 1. Care must also be taken when choosing a(n) if it is equal to any previously occurring mod value as one is not then guaranteed the next term will exist - in such cases smaller unused mod values must be checked for a valid next term, otherwise the term must be rejected and the next largest candidate trialled.
Surprisingly the first prime to occur is a(94122) = 47857. The next is a(103105) = 26591, and no other primes appear in the first 500000 terms. It is unknown if more occur or why it takes so many terms for a prime to appear. Many small primes, like 5, can never occur as all mod values less than the prime have already appeared. It is conjectured all missing numbers are prime.
In the first 500000 terms the fixed points are 111, 533, 649, 11957; it is unknown if more exist.
Keyword "look" refers to Scott Shannon's image of 100000 terms. - N. J. A. Sloane, Oct 19 2024
LINKS
Scott R. Shannon, Table of n, a(n) for n = 1..10000
Michael De Vlieger, Log log scatterplot of a(n), n = 1..2^17, showing primes in red, perfect prime powers in gold, squarefree composites in green, and numbers neither squarefree nor prime powers in blue and purple, accentuating powerful numbers that are not prime powers in purple.
Scott R. Shannon, Image of the first 100000 terms. The green line is a(n) = n.
EXAMPLE
a(4) = 6 as a(2) mod a(3) = 3 mod 4 = 3, and 6 is the earliest unused number that shares a factor with 3 while 3 has not occurred as a mod value for any previous pair.
a(9) = 14 as a(7) mod a(8) = 10 mod 12 = 10, and 14 factor with 10. Note that 5 is unused and shares a factor with 10 but a(8) mod 5 = 12 mod 5 = 2, but 2 has previously occurred as the mod value for a(1) mod a(2), so 5 cannot be used. This is the first term to differ from A377078.
MATHEMATICA
nn = 120;
c[_] := False; m[_] := False;
Array[Set[{a[#], c[# + 1]}, {# + 1, True}] &, 2];
Set[{i, j, v}, {a[1], a[2], 2}];
mj = Mod[i, j]; Array[Set[m[#], True] &, mj + 1, 0];
Do[k = v;
While[Set[mk, Mod[j, k]]; Or[c[k], m[mk], m[k], CoprimeQ[mj, k]], k++];
While[m[v], v++];
Set[{a[n], c[k], m[mk], i, j, mj}, {k, True, True, j, k, mk}], {n, 3, nn}];
Array[a, nn] (* Michael De Vlieger, Oct 19 2024 *)
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Scott R. Shannon, Oct 18 2024
STATUS
approved