[go: up one dir, main page]

login
A241757
Numbers n such that 2n is a sum of two primes, the adding of which requires only one carry in binary.
4
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,1
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
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
EXAMPLE
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.
PROG
(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
CROSSREFS
Cf. A241405.
Sequence in context: A255370 A061845 A297836 * A377473 A272883 A257283
KEYWORD
nonn
AUTHOR
Vladimir Shevelev, Apr 28 2014
EXTENSIONS
More terms from Peter J. C. Moses, Apr 29 2014
STATUS
approved