cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-2 of 2 results.

A090418 Number of ways to write n in binary representation as a concatenation of primes.

Original entry on oeis.org

0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 2, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 3, 0, 0, 0, 0, 0, 2, 1, 3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 3, 0, 2, 2, 4, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 3, 0, 3, 1, 2, 0, 0, 0, 1, 0, 0, 1, 2, 0, 1, 0, 0, 0, 0, 1, 2, 0, 1, 0, 2, 0, 1, 1
Offset: 0

Views

Author

Reinhard Zumkeller, Nov 30 2003

Keywords

Examples

			n=23 -> '10111': '10"111'==2"7, '101"11'==5"3 and '10111'==23, therefore a(23)=3.
		

Crossrefs

Programs

  • 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

Formula

a(A090419(n))=0; a(A090420(n))=1; a(A090421(n))>0;
a(A090422(n))=1; a(A090423(n))>1;
a(A090424(n)) = n and a(m) <> n for m < A090424(n).
a(n) = 0 if a = 0 (mod 4); a(n) = a(floor(n/4)) if a = 2 (mod 4). - M. F. Hasler, Apr 21 2015

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

A256872 Numbers whose binary expansion is the concatenation of the binary expansion of two prime numbers in at least two ways.

Original entry on oeis.org

23, 31, 45, 47, 61, 93, 95, 119, 125, 127, 175, 187, 189, 191, 239, 247, 253, 255, 335, 357, 359, 363, 369, 379, 381, 383, 431, 439, 455, 477, 485, 491, 493, 495, 507, 509, 511, 573, 575, 631, 637, 639, 669, 671
Offset: 1

Views

Author

M. F. Hasler, Apr 21 2015

Keywords

Comments

A simplified variant (and subsequence) of A257318 (and A090421) where the concatenation of any number of primes is considered.
The subsequence of numbers which are concatenation of 2 primes in at least 3 ways is (93, 95, 189, 191, 239, 253, 335, 381, 383, 669, ...).
All terms are odd. Indeed, if an even number n > 2 is concatenation of two primes (in binary), then it is of the form 'n' = 'floor(n/4)''2' (where 'x' is x in binary), and there is no other possible decomposition.

Examples

			23 = 10111[2] = (10[2])(111[2]) = (101[2])(11[2]) which is (2)(7) resp. (5)(3).
		

Crossrefs

Programs

  • PARI
    is(n,c=2)={for(i=2,#binary(n)-2,bittest(n,i-1)&&isprime(n>>i)&&isprime(n%2^i)&&!c--&&return(1))}

Formula

A090418(a(n)) >= 2. (Necessary but not sufficient condition. This actually characterizes elements of A257318. For example, all terms of A090423 satisfy this but many of them are not terms of this sequence.)
Showing 1-2 of 2 results.