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.

A039995 Number of distinct primes which occur as subsequences of the sequence of digits of n.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

a(n) counts subsequences of digits of n which denote primes.

Examples

			a(103) = 3; the 3 primes are 3, 13 and 103.
		

Crossrefs

A039997 counts only the primes which occur as substrings, i.e. contiguous subsequences. Cf. A035232.
Cf. A010051.

Programs

  • Haskell
    import Data.List (subsequences, nub)
    a039995 n = sum $
       map a010051 $ nub $ map read (tail $ subsequences $ show n)
    -- Reinhard Zumkeller, Jan 31 2012
    
  • Mathematica
    cnt[n_] := Module[{d = IntegerDigits[n]}, Length[Union[Select[FromDigits /@ Subsets[d], PrimeQ]]]]; Table[cnt[n], {n, 105}] (* T. D. Noe, Jan 31 2012 *)
  • Python
    from sympy import isprime
    from itertools import chain, combinations as combs
    def powerset(s): # nonempty subsets of s
        return chain.from_iterable(combs(s, r) for r in range(1, len(s)+1))
    def a(n):
        ss = set(int("".join(s)) for s in powerset(str(n)))
        return sum(1 for k in ss if isprime(k))
    print([a(n) for n in range(1, 106)]) # Michael S. Branicky, Aug 07 2022

Formula

a(A094535(n)) = n and a(m) < n for m < A094535(n); A039995(39467139) = 100, cf. A205956. - Reinhard Zumkeller, Feb 01 2012

A205956 Distinct primes occurring as not necessarily consecutive subsequences in decimal representation of 39467139.

Original entry on oeis.org

3, 7, 13, 19, 31, 37, 41, 43, 47, 61, 67, 71, 73, 79, 97, 139, 313, 347, 349, 367, 373, 379, 397, 419, 439, 461, 463, 467, 479, 613, 619, 673, 719, 739, 919, 941, 947, 967, 971, 3413, 3461, 3463, 3467, 3469, 3613, 3671, 3673, 3719, 3739, 3919, 3943, 3947
Offset: 1

Views

Author

Reinhard Zumkeller, Feb 02 2012

Keywords

Comments

39467139 is the smallest number containing exactly 100 primes: A094535(100) = 39467139, A039995(39467139) = 100; 39467139 itself is not prime: 39467139 = 3*53*89*2789.

Examples

			a(10) = 61        <- ___6_1__;
a(20) = 367       <- 3__67___;
a(30) = 613       <- ___6_13_;
a(40) = 3413      <- 3_4__13_;
a(50) = 3919      <- 39___1_9;
a(60) = 9419      <- _94__1_9;
a(70) = 9719      <- _9__71_9;
a(80) = 39439     <- 394___39;
a(90) = 346139    <- 3_46_139;
a(100) = 3946139  <- 3946_139.
		

Crossrefs

Cf. A010051.

Programs

  • Haskell
    import Data.List (subsequences, nub, sort)
    a205956 n = a205956_list !! (n-1)
    a205956_list = sort $ filter ((== 1) . a010051) $
                          nub $ map read (tail $ subsequences "39467139")
Showing 1-2 of 2 results.