OFFSET
1,2
COMMENTS
A subsequence of A221643.
Conjecture: the sequence is infinite.
PROG
(C)
#include <stdio.h>
#include <math.h>
int main() {
unsigned long long a, i, t;
for (i=0; i < (1L<<32)-2; ++i) {
a = (i*i) ^ ((i+1)*(i+1));
t = sqrt(a);
if (a != t*t) continue;
a = (i*i) ^ ((i+2)*(i+2));
t = sqrt(a);
if (a != t*t) continue;
printf("%llu, ", i);
}
return 0;
}
(Java)
class A224241 {
static public BigInteger isqrt(final BigInteger n)
{
if ( n.compareTo(BigInteger.ZERO) < 0 )
throw new ArithmeticException("Negative argument "+ n.toString()) ;
BigInteger x ;
final int bl = n.bitLength() ;
if ( bl > 120)
x = n.shiftRight(bl/2-1) ;
else
{
final double resul= Math.sqrt(n.doubleValue()) ;
x = new BigInteger(""+Math.round(resul)) ;
}
final BigInteger two = new BigInteger("2") ;
while ( true)
{
BigInteger x2 = x.pow(2) ;
BigInteger xplus2 = x.add(BigInteger.ONE).pow(2) ;
if ( x2.compareTo(n) <= 0 && xplus2.compareTo(n) > 0)
return x ;
xplus2 = xplus2.subtract(x.shiftLeft(2)) ;
if ( xplus2.compareTo(n) <= 0 && x2.compareTo(n) > 0)
return x.subtract(BigInteger.ONE) ;
xplus2 = x2.subtract(n).divide(x).divide(two) ;
x = x.subtract(xplus2) ;
}
}
static public void main(String[] argv)
{
for(BigInteger k = BigInteger.ZERO ; ; k= k.add(BigInteger.ONE) )
{
final BigInteger k2 = k.pow(2) ;
final BigInteger kplus1 = k.add(BigInteger.ONE) ;
final BigInteger k12 = kplus1.pow(2) ;
final BigInteger xor1 = k2.xor(k12) ;
final BigInteger roo1 = isqrt(xor1) ;
if ( roo1.pow(2).compareTo(xor1) == 0 )
{
final BigInteger k22 = kplus1.add(BigInteger.ONE).pow(2) ;
final BigInteger xor2 = k2.xor(k22) ;
final BigInteger roo2 = isqrt(xor2) ;
if ( roo2.pow(2).compareTo(xor2) == 0 )
System.out.println(k) ;
}
}
}
}
// R. J. Mathar, Apr 25 2013
CROSSREFS
KEYWORD
nonn,base,more,less
AUTHOR
Alex Ratushnyak, Apr 01 2013
STATUS
approved