%I #17 Nov 17 2022 16:54:21
%S 1,2,5,29,4,857,10,734549,539562233501,6,12433,15,8,17,353,12,124753,
%T 13,14,20,16,18,22,24,25,1201,26,41,2357,28,5556233,37,30,2269,39,32,
%U 35,52,3929,40,15438641,82,45,65,34,5381,78,50,36,38,42,44,46,48,51,3,9,21,27,33,54,55,91
%N a(1) = 1, a(2) = 2; for n > 2, a(n) = smallest positive number which has not appeared that has a common factor with a(n-2)^2 + a(n-1)^2.
%C The majority of terms are concentrated along or just above the line a(n) = n, resulting in 51 fixed points in the first 5000 terms. However, some terms are much larger because the sum of the squares of the previous two terms is a prime number.
%C Conjecture: the sequence is a permutation of the positive integers.
%H Michael De Vlieger, <a href="/A358444/b358444.txt">Table of n, a(n) for n = 1..10000</a>
%H Scott R. Shannon, <a href="/A358444/a358444.png">Image of the first 10000 terms where a(n) is within 10% of n</a>. The green line is a(n) = n.
%H Michael De Vlieger, <a href="/A358444/a358444_1.png">Log-log scatterplot of a(n)</a>, n = 1..24857. a(24858) is a multiple of a prime factor of 2345424289569907866042152579118178340801^2 + 24922^2.
%H Michael De Vlieger, <a href="/A358444/a358444.txt">Table of n, a(n)</a> for n = 1..65536.
%e a(5) = 4 as a(3)^2 + a(4)^2 = 25 + 841 = 866, and 4 is the smallest unused number that shares a factor with 866.
%e a(9) = 539562233501 as a(7)^2 + a(8)^2 = 100 + 539562233401 = 539562233501, which is a prime number.
%t nn = 120; c[_] = False; q[_] = 1; Do[Set[{a[i], c[i], q[i]}, {i, True, 2}], {i, 2}]; i = a[1]^2; j = a[2]^2; Do[k = i + j; s = FactorInteger[k][[All, 1]]; Do[(m = q[#]; While[c[# m], m++]; q[#] = m; If[# m < k, k = # m]) &[s[[n]]], {n, Length[s]}]; Set[{a[n], c[k], i, j}, {k, True, j, k^2}], {n, 3, nn}]; Array[a, nn] (* _Michael De Vlieger_, Nov 17 2022 *)
%Y Cf. A337136, A347594, A098550, A336957.
%K nonn
%O 1,2
%A _Scott R. Shannon_, Nov 16 2022