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
KEYWORD
nonn
AUTHOR
Vladimir Shevelev, Apr 28 2014
EXTENSIONS
More terms from Peter J. C. Moses, Apr 29 2014
STATUS
approved