OFFSET
1,1
COMMENTS
This sequence is a permutation of the prime numbers.
LINKS
Michael De Vlieger, Annotated log-log scatterplot of a(n), n = 1..10^4, showing records in red, local minima in blue, and fixed points in gold.
EXAMPLE
The earliest pairs with their square sum: (2, 7) = 9, (3, 13) = 16, (5, 11) = 16, (17, 19) = 36, (23, 41) = 64, (29, 71) = 100, (31, 113) = 144, (37, 107) = 144, etc.
MATHEMATICA
nn = 120; c[_] = 0; a[1] = 2; c[2] = 1; u = 3; Do[k = u; If[EvenQ@ i, While[Nand[c[k] == 0, IntegerQ@ Sqrt[# + k]] &[a[i - 1]], k = NextPrime[k]]]; Set[{a[i], c[k]}, {k, i}]; If[k == u, While[c[u] > 0, u = NextPrime[u]]], {i, 2, nn}], i]; Array[a, nn] (* Michael De Vlieger, May 24 2022 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Eric Angelini and Carole Dubois, May 24 2022
STATUS
approved