OFFSET
1,2
COMMENTS
This is not a permutation of the integers > 0 as no square > 4 will appear. Two prime terms can form a pair (2 and 7 for instance) but at least one term must be prime [the pair (1, 3) is ok].
LINKS
Michael De Vlieger, Annotated log-log scatterplot of a(n), n = 1..10^4, showing records in red, numbers entering late in blue, highlighting primes in green, fixed points in gold, and composite prime powers in magenta.
EXAMPLE
The earliest pairs with their square sum: (1, 3) = 4, (2, 7) = 9, (4, 5) = 9, (6, 19) = 25, (8, 17) = 25, (10, 71) = 81, (11, 14) = 25, (12, 13) = 25, etc.
MATHEMATICA
nn = 10^4; c[_] = 0; a[1] = c[1] = 1; u = 2; Do[k = u; If[EvenQ[i], While[Nand[c[k] == 0, AnyTrue[{#, k}, PrimeQ], IntegerQ@ Sqrt[# + k]] &[a[i - 1]], k++]]; Set[{a[i], c[k]}, {k, i}]; If[k == u, While[Or[c[u] > 0, And[IntegerQ@ Sqrt@ u, u > 4]], u++]], {i, 2, nn}]; Array[a, nn] (* Michael De Vlieger, May 24 2022 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Eric Angelini and Carole Dubois, May 24 2022
STATUS
approved