login
Successive pairs of terms (a, b) such that (a + b) is a square and at least one of a and b is a prime number. This is the lexicographically earliest infinite sequence of distinct terms > 0 with this property.
4

%I #12 Jun 25 2022 22:01:52

%S 1,3,2,7,4,5,6,19,8,17,10,71,11,14,12,13,15,181,18,31,20,29,21,43,22,

%T 59,23,26,24,97,27,37,28,53,30,139,32,89,33,67,34,47,35,109,38,83,39,

%U 61,40,41,42,79,44,317,45,151,46,179,48,73,50,239,51,349,52,173,54,307,55,269,56,113,57,199,58

%N Successive pairs of terms (a, b) such that (a + b) is a square and at least one of a and b is a prime number. This is the lexicographically earliest infinite sequence of distinct terms > 0 with this property.

%C 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].

%H Michael De Vlieger, <a href="/A354367/a354367.png">Annotated log-log scatterplot of a(n)</a>, 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.

%e 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.

%t 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 *)

%Y Cf. A354368, A354369, A354370 (same idea).

%K nonn

%O 1,2

%A _Eric Angelini_ and _Carole Dubois_, May 24 2022