OFFSET
1,1
COMMENTS
The set F=F(n) of primes corresponding to a(n) is such that its characteristic function, within the set of primes, is the binary expansion of n: F={ prime(i[1]),...,prime(i[m]) } <=> n = 2^(i[1]-1) + ... + 2^(i[m]-1). Otherwise said, the set F is the set of prime factors of A019565(n) = Product_(prime(i)^bittest(n,i-1)).
LINKS
D. Skordev et al., On the representation of some even numbers as sums of two prime numbers, in "primenumbers" yahoo group, Feb 02 2011.
Dimiter Skordev and others, On the representation of some even numbers as sums of two prime numbers, digest of 11 messages in primenumbers Yahoo group, Feb 2, 2011 - Feb 3, 2011.
FORMULA
a(2k) = 2; a(4k-3) = 3; a(2^k-1) = A185446(n) > prime(n).
EXAMPLE
For n=3, we look for the least prime P which cannot be written as sum of two primes involving prime(1)=2 or prime(2)=3 (since n=3=2^0+2^1). See A185446 for details about a(3)=19.
If n is even, this means the set F does not contain 2, and therefore a(n)=2 since 2*2 can only be written as 2+2, using primes not in F.
If n=4k-3, its binary expansion ends in ...01, i.e., the set F does contain prime(1)=2, but not prime(2)=3. Therefore a(n)=3, since 2*3 can only be written as 3+3, using primes not in F.
PROG
(PARI) {a(n) = forprime( p=2, default(primelimit),
bittest(n, primepi(p-1))&next; /*if p is in F, then 2p = p+p */
forprime(q=2, p-1 /* no need to test p+p */,
isprime(2*p-q) | next /* not sum of 2 primes */;
! bittest(n, primepi(q-1)) /* q not in F */
& ! bittest(n, primepi(2*p-q-1)) & next; /* ok: both not in F */
/* one among q, 2p-q is in F: this p is not good:*/ next(2));
/* this p*2 had no decomposition of the form q+r with q or r in F */
return(p))}
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler, Feb 03 2011
STATUS
approved