login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A224241
Numbers k such that k^2 XOR (k+1)^2 is a square, and k^2 XOR (k+2)^2 is also a square, where XOR is the bitwise logical exclusive-or operator.
1
0, 3, 130456, 342096, 1226720, 291575011, 379894587, 523040160, 15216609776, 136622606520
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
Cf. A221643.
Sequence in context: A086785 A159577 A116536 * A178505 A306594 A003544
KEYWORD
nonn,base,more,less
AUTHOR
Alex Ratushnyak, Apr 01 2013
STATUS
approved