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.

A358690 Number of n-digit primes whose digits are all odd.

Original entry on oeis.org

3, 12, 42, 125, 608, 2427, 10081, 43568, 197823, 873432, 3978580, 18159630, 83753054, 387670103, 1811802273, 8451565541, 39790817677
Offset: 1

Views

Author

Zhining Yang, Nov 26 2022

Keywords

Examples

			a(2) = 12 as there are 12 2-digit primes whose digits are all odd: 11, 13, 17, 19, 31, 37, 53, 59, 71, 73, 79, 97.
		

Crossrefs

Programs

  • Mathematica
    Length[Select[Prime[Range[PrimePi[10^(n - 1)], PrimePi[10^n]]], And @@ OddQ[IntegerDigits[#]] &]]
  • Python
    from sympy import primerange
    def a(n):
        num=0
        for f in range(1,10,2):
            p=list(primerange(f*10**(n-1),(f+1)*10**(n-1)))
            num+=sum(1 for k in p if all(int(d) %2 for d in str(k)))
        return(num)
    print ([a(n) for n in range(1,8)])
    
  • Python
    from sympy import isprime
    from itertools import count, islice, product
    def a(n):
        c = 0 if n > 1 else 1
        for p in product("13579", repeat=n-1):
            s = "".join(p)
            for last in "1379":
                if isprime(int(s+last)): c += 1
        return c
    print([a(n) for n in range(1, 10)]) # Michael S. Branicky, Nov 27 2022

Formula

a(n) = A358685(n) - A358685(n-1).

Extensions

a(10)-a(14) from Michael S. Branicky, Nov 26 2022
a(15) from Zhining Yang, Dec 21 2022
a(16)-a(17) from Martin Ehrenstein, Dec 24 2022