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.

A241757 Numbers n such that 2n is a sum of two primes, the adding of which requires only one carry in binary.

Original entry on oeis.org

2, 11, 15, 23, 27, 29, 39, 45, 47, 51, 55, 57, 59, 63, 71, 77, 87, 95, 99, 103, 105, 107, 111, 115, 117, 119, 123, 125, 127, 131, 135, 137, 143, 147, 149, 155, 159, 165, 171, 173, 175, 177, 179, 183, 185, 187, 189, 191, 197, 203, 207, 215, 219, 221, 223, 225
Offset: 1

Views

Author

Vladimir Shevelev, Apr 28 2014

Keywords

Comments

Apart from a(1), both primes are 1 mod 4, hence 2 is the only even term in the sequence. - Charles R Greathouse IV, Apr 29 2014

Examples

			2 is in the sequence since 2*2=2+2 is a sum of two primes and adding 2+2 requires only one carry in binary.
		

Crossrefs

Cf. A241405.

Programs

  • PARI
    is(n)=if(n%2==0, return(n==2)); forprime(p=2,n,if(p%4==1 && isprime(2*n-p) && bitand(p, 2*n-p)==1, return(1))); 0 \\ Charles R Greathouse IV, Apr 29 2014
    
  • PARI
    MSB(n)=2^(#binary(n)-1);
    is(n)={
        if(n%2==0, return(n==2));
        my(V=(n - MSB(n))>>1, k=0);
        while(k=bitand(k-V,V),    \\ Note: assignment, not comparison
            my(p=4*k+1,q=2*n-p);
            if(isprime(p) && isprime(q), return(1))
        );
        0
    }; \\ Charles R Greathouse IV, Apr 30 2014

Extensions

More terms from Peter J. C. Moses, Apr 29 2014