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.

Original entry on oeis.org

0, 3, 130456, 342096, 1226720, 291575011, 379894587, 523040160, 15216609776, 136622606520
Offset: 1

Views

Author

Alex Ratushnyak, Apr 01 2013

Keywords

Comments

A subsequence of A221643.
Conjecture: the sequence is infinite.

Crossrefs

Cf. A221643.

Programs

  • C
    #include 
    #include 
    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