%I #17 Feb 01 2025 14:58:29
%S 0,4,3,24,23,44,43,112,111,180,76,264,248,348,164,480,479,411,611,327,
%T 183,115,139,943,1103,747,787,1111,1447,323,699,1984,1983,1851,2243,
%U 2008,1576,1388,1684,1072,976,1268,499,3383,3271,4124,4068,3679,4511,4315,3804,4999
%N a(n) = least k such that sqrt(k^2 XOR (k+1)^2) = 2*n+1, a(n) = -1 if there is no such k.
%C Conjectures:
%C 1. a(n) >= 0.
%C 2. Least k is also the only such k.
%C If both conjectures are true, then the sequence is a permutation of A221643.
%H Charles R Greathouse IV, <a href="/A224515/b224515.txt">Table of n, a(n) for n = 0..1000</a>
%t a[n_] := For[k=0, k <= 3*n^2+1, k++, If[ Sqrt[ BitXor[k^2, (k+1)^2]] == 2*n+1, Return[k]]] /. Null -> -1; a /@ Range[0, 51] (* _Jean-François Alcover_, Jun 05 2013 *)
%o (Python)
%o import math
%o needTerms = n = 1024
%o i = 0
%o terms = [-1] * n
%o while n:
%o s = (i*i) ^ ((i+1)*(i+1))
%o r = int(math.sqrt(s))
%o if s == r*r:
%o if (r&1)==0: break
%o r = (r-1)//2
%o if r < needTerms:
%o if terms[r] >= 0: break
%o terms[r] = i
%o n -= 1
%o i += 1
%o if n: print('Error')
%o else:
%o for i in range(needTerms):
%o t = terms[i]
%o print(t, end=', ') # math.sqrt((t*t) ^ ((t+1)*(t+1)))
%o (PARI) a(n)=my(k=sqrtint(2*n^2),t);while(!issquare(bitxor(k^2,(k+1)^2),&t)||t!=2*n+1,k++);k \\ _Charles R Greathouse IV_, Jun 05 2013
%Y Cf. A221643.
%K nonn,base,less,changed
%O 0,2
%A _Alex Ratushnyak_, Apr 08 2013