OFFSET
1,1
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
EXAMPLE
337 is 101010001 in binary,
10 is 2,
10 is 2,
10001 is 17, partition is 10_10_10001, so 337 is in the sequence.
PROG
(Python)
# Primes = [2, ..., 607]
from sympy import sieve
primes = list(sieve.primerange(1, 608))
def tryPartioning(binString): # First digit is not 0
l = len(binString)
for t in range(2, l-1):
substr1 = binString[:t]
if (int('0b'+substr1, 2) in primes) or (t>=4 and tryPartioning(substr1)):
substr2 = binString[t:]
if substr2[0]!='0':
if (int('0b'+substr2, 2) in primes) or (l-t>=4 and tryPartioning(substr2)):
return 1
return 0
for p in primes:
if tryPartioning(bin(p)[2:]):
print(p, end=', ')
(Python)
from sympy import isprime, primerange
def ok(p):
b = bin(p)[2:]
for i in range(2, len(b)-1):
if isprime(int(b[:i], 2)) and b[i] != '0':
if isprime(int(b[i:], 2)) or ok(int(b[i:], 2)): return True
return False
def aupto(lim): return [p for p in primerange(2, lim+1) if ok(p)]
print(aupto(607)) # Michael S. Branicky, May 16 2021
(Haskell)
a090423 n = a090423_list !! (n-1)
a090423_list = filter ((> 1 ) . a090418 . fromInteger) a000040_list
-- Reinhard Zumkeller, Aug 06 2012
(PARI) is_A090423(n)={isprime(n)&&for(i=2, #binary(n)-2, bittest(n, i-1)&&isprime(n%2^i)&&is_A090421(n>>i)&&return(1))} \\ M. F. Hasler, Apr 21 2015
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Reinhard Zumkeller, Nov 30 2003
EXTENSIONS
Corrected by Alex Ratushnyak, Aug 03 2012
STATUS
approved