cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A224241 #13 Jul 19 2016 11:36:09
%S A224241 0,3,130456,342096,1226720,291575011,379894587,523040160,15216609776,
%T A224241 136622606520
%N 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.
%C A224241 A subsequence of A221643.
%C A224241 Conjecture: the sequence is infinite.
%o A224241 (C)
%o A224241 #include <stdio.h>
%o A224241 #include <math.h>
%o A224241 int main() {
%o A224241   unsigned long long a, i, t;
%o A224241   for (i=0; i < (1L<<32)-2; ++i) {
%o A224241       a = (i*i) ^ ((i+1)*(i+1));
%o A224241       t = sqrt(a);
%o A224241       if (a != t*t) continue;
%o A224241       a = (i*i) ^ ((i+2)*(i+2));
%o A224241       t = sqrt(a);
%o A224241       if (a != t*t) continue;
%o A224241       printf("%llu, ", i);
%o A224241   }
%o A224241   return 0;
%o A224241 }
%o A224241 (Java)
%o A224241 class A224241 {
%o A224241         static public BigInteger isqrt(final BigInteger n)
%o A224241         {
%o A224241                 if ( n.compareTo(BigInteger.ZERO) < 0 )
%o A224241                         throw new ArithmeticException("Negative argument "+ n.toString()) ;
%o A224241                 BigInteger x  ;
%o A224241                 final int bl = n.bitLength() ;
%o A224241                 if ( bl > 120)
%o A224241                         x = n.shiftRight(bl/2-1) ;
%o A224241                 else
%o A224241                 {
%o A224241                         final double resul= Math.sqrt(n.doubleValue()) ;
%o A224241                         x = new BigInteger(""+Math.round(resul)) ;
%o A224241                 }
%o A224241                 final BigInteger two = new BigInteger("2") ;
%o A224241                 while ( true)
%o A224241                 {
%o A224241                         BigInteger x2 = x.pow(2) ;
%o A224241                         BigInteger xplus2 = x.add(BigInteger.ONE).pow(2) ;
%o A224241                         if ( x2.compareTo(n) <= 0 && xplus2.compareTo(n) > 0)
%o A224241                                 return x ;
%o A224241                         xplus2 = xplus2.subtract(x.shiftLeft(2)) ;
%o A224241                         if ( xplus2.compareTo(n) <= 0 && x2.compareTo(n) > 0)
%o A224241                                 return x.subtract(BigInteger.ONE) ;
%o A224241                         xplus2 = x2.subtract(n).divide(x).divide(two) ;
%o A224241                         x = x.subtract(xplus2) ;
%o A224241                 }
%o A224241         }
%o A224241     static public void main(String[] argv)
%o A224241     {
%o A224241         for(BigInteger k = BigInteger.ZERO ;  ; k= k.add(BigInteger.ONE) )
%o A224241         {
%o A224241             final BigInteger k2 = k.pow(2) ;
%o A224241             final BigInteger kplus1 = k.add(BigInteger.ONE) ;
%o A224241             final BigInteger k12 = kplus1.pow(2) ;
%o A224241             final BigInteger xor1 = k2.xor(k12) ;
%o A224241             final BigInteger roo1 = isqrt(xor1) ;
%o A224241             if ( roo1.pow(2).compareTo(xor1) == 0 )
%o A224241             {
%o A224241                 final BigInteger k22 = kplus1.add(BigInteger.ONE).pow(2) ;
%o A224241                 final BigInteger xor2 = k2.xor(k22) ;
%o A224241                 final BigInteger roo2 = isqrt(xor2) ;
%o A224241                 if ( roo2.pow(2).compareTo(xor2) == 0 )
%o A224241                     System.out.println(k) ;
%o A224241             }
%o A224241         }
%o A224241     }
%o A224241 }
%o A224241 // _R. J. Mathar_, Apr 25 2013
%Y A224241 Cf. A221643.
%K A224241 nonn,base,more,less
%O A224241 1,2
%A A224241 _Alex Ratushnyak_, Apr 01 2013