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.

A358685 Number of primes < 10^n whose digits are all odd.

Original entry on oeis.org

3, 15, 57, 182, 790, 3217, 13298, 56866, 254689, 1128121, 5106701, 23266331, 107019385, 494689488, 2306491761, 10758057302, 50548874979
Offset: 1

Views

Author

Zhining Yang, Nov 26 2022

Keywords

Examples

			a(2) = 15 as there are 15 primes less than 100 whose digits are all odd: 3, 5, 7, 11, 13, 17, 19, 31, 37, 53, 59, 71, 73, 79, 97.
		

Crossrefs

Programs

  • Mathematica
    n=7
    Length[Select[Prime[Range[PrimePi[10^n]]], And @@ OddQ[IntegerDigits[#]] &]] (* Zhining Yang, Nov 26 2022 *)
    n = PrimePi[10^8];
    Sum[If[MemberQ[IntegerDigits[Prime[i]], _?EvenQ], 0, 1], {i, 1, n}]
    (* Jianlin Su, Nov 27 2022 *)
  • Python
    from sympy import primerange
    def a(n):
        p=list(primerange(3,10**n))
        return(sum(1 for k in p if all(int(d) %2 for d in str(k))==True))
    print ([a(n) for n in range(1,8)])
    
  • Python
    from sympy import isprime
    from itertools import count, islice, product
    def agen(): # generator of terms
        c = 3
        for d in count(2):
            yield c
            for p in product("13579", repeat=d-1):
                s = "".join(p)
                for last in "1379":
                    if isprime(int(s+last)): c += 1
    print(list(islice(agen(), 9))) # Michael S. Branicky, Nov 27 2022

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 21 2022

A359813 Number of primes < 10^n with exactly one odd decimal digit.

Original entry on oeis.org

3, 12, 45, 171, 619, 2560, 10774, 46708, 202635, 904603, 4073767, 18604618, 85445767, 395944114, 1837763447, 8600149593
Offset: 1

Views

Author

Zhining Yang, Jan 14 2023

Keywords

Comments

a(n) =~ Pi(10^n)/2^(n-1). Robert G. Wilson v, Feb 04 2023

Examples

			a(2)=12 as there are 12 primes less than 100 with exactly one odd decimal digit: 3, 5, 7, 23, 29, 41, 43, 47, 61, 67, 83, 89.
		

Crossrefs

Programs

  • Mathematica
    c=1; k=0; lst={}; f[n_] := Block[{e = 10 FromDigits[2 IntegerDigits[n, 5]]}, Length@ Select[e + {1, 3, 7, 9}, PrimeQ]];
    Do[ While[k< 5^n, c+=f@k; k++]; Print[c], {n, 0, 16}] (* Robert G. Wilson v, Feb 04 2023 *)
  • Python
    from sympy import isprime
    from itertools import  product
    def a(n):
        c=3
        if n==1:return(c)
        x=[[1,7],[1,3,7,9],[3,9],'2468','02468']
        for k in range(2,n+1):
            for f in x[3]:
                for m in product(x[4], repeat=k-2):
                    s = int(f+"".join(m))*10
                    t=s%3
                    for last in x[t]:
                        if isprime(s+last):
                            c+= 1
        return(c)
    print([a(n) for n in range(1,7)])
    
  • Python
    from sympy import primerange
    def a(n):
        p=list(primerange(3,10**n))
        return(sum(1 for k in p if sum(str(k).count(d) for d in '13579')==1))
    print([a(n) for n in range(1,7)])

Extensions

a(16) from Robert G. Wilson v, Feb 04 2023
Showing 1-2 of 2 results.