login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

A subsequence of A221643.

Conjecture: the sequence is infinite.

LINKS

Table of n, a(n) for n=1..10.

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

Adjacent sequences:  A224238 A224239 A224240 * A224242 A224243 A224244

KEYWORD

nonn,base,more,less

AUTHOR

Alex Ratushnyak, Apr 01 2013

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 28 15:04 EDT 2022. Contains 354115 sequences. (Running on oeis4.)