login
A224515
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.
2
0, 4, 3, 24, 23, 44, 43, 112, 111, 180, 76, 264, 248, 348, 164, 480, 479, 411, 611, 327, 183, 115, 139, 943, 1103, 747, 787, 1111, 1447, 323, 699, 1984, 1983, 1851, 2243, 2008, 1576, 1388, 1684, 1072, 976, 1268, 499, 3383, 3271, 4124, 4068, 3679, 4511, 4315, 3804, 4999
OFFSET
0,2
COMMENTS
Conjectures:
1. a(n) >= 0.
2. Least k is also the only such k.
If both conjectures are true, then the sequence is a permutation of A221643.
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 0..1000
MATHEMATICA
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 *)
PROG
(Python)
import math
needTerms = n = 1024
i = 0
terms = [-1] * n
while n:
s = (i*i) ^ ((i+1)*(i+1))
r = int(math.sqrt(s))
if s == r*r:
if (r&1)==0: break
r = (r-1)/2
if r < needTerms:
if terms[r] >= 0: break
terms[r] = i
n -= 1
i += 1
if n: print 'Error'
else:
for i in range(needTerms):
t = terms[i]
print str(t)+', ', #math.sqrt((t*t) ^ ((t+1)*(t+1)))
(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
CROSSREFS
Cf. A221643.
Sequence in context: A287717 A286641 A288360 * A286328 A189742 A350173
KEYWORD
nonn,base,less
AUTHOR
Alex Ratushnyak, Apr 08 2013
STATUS
approved