OFFSET
0,12
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..10000 (corrected by Georg Fischer, Jan 20 2019)
FORMULA
EXAMPLE
n=23 -> '10111': '10"111'==2"7, '101"11'==5"3 and '10111'==23, therefore a(23)=3.
PROG
(Haskell)
import Data.List (stripPrefix, unfoldr)
import Data.Maybe (fromJust)
a090418 n = a090418_list !! (n-1)
a090418_list = 0 : f 2 where
f x = (sum $ map g bpss) : f (x + 1) where
g ps | suffix == Nothing = 0
| suffix' == [] = 1
| last suffix' == 0 = 0
| otherwise = a090418 $ fromBits suffix'
where suffix' = fromJust suffix
suffix = stripPrefix ps $ toBits x
bpss = take (fromInteger $ a000720 x) $
map (toBits . fromInteger) a000040_list
toBits = unfoldr
(\u -> if u == 0 then Nothing else Just (mod u 2, div u 2))
fromBits = foldr (\b v -> 2 * v + b) 0
-- Reinhard Zumkeller, Aug 06 2012
(PARI) A090418(n)={ while( n>9 && !bittest(n, 0), bittest(n, 1)||return; n>>=2); n<10 && return(isprime(n)); sum(k=2, #binary(n)-2, if(bittest(n, k-1)&&isprime(n%2^k), A090418(n>>k)), isprime(n))} \\ M. F. Hasler, Apr 21 2015
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Reinhard Zumkeller, Nov 30 2003
EXTENSIONS
Thanks to Alex Ratushnyak, who found an error in A090423, which was the consequence of errors in this sequence; the program was rewritten and data was recomputed by Reinhard Zumkeller, Aug 06 2012
Data in b-file double-checked with independent PARI code by M. F. Hasler, Apr 21 2015
STATUS
approved