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-4 of 4 results.

A068690 Primes such that all digits (except perhaps the least significant digit) are even.

Original entry on oeis.org

2, 3, 5, 7, 23, 29, 41, 43, 47, 61, 67, 83, 89, 223, 227, 229, 241, 263, 269, 281, 283, 401, 409, 421, 443, 449, 461, 463, 467, 487, 601, 607, 641, 643, 647, 661, 683, 809, 821, 823, 827, 829, 863, 881, 883, 887, 2003, 2027, 2029, 2063, 2069, 2081, 2083, 2087
Offset: 1

Views

Author

Amarnath Murthy and Joseph L. Pe, Mar 03 2002

Keywords

Comments

Essentially the same as A154764.

Examples

			2 is in the sequence even though the least significant digit of 2 is even instead of odd. - _David A. Corneth_, Sep 18 2019
		

Crossrefs

Programs

  • Haskell
    a068690 n = a068690_list !! (n-1)
    a068690_list = filter (all (`elem` "02468") . init . show) a000040_list
    -- Reinhard Zumkeller, Apr 28 2014
  • Mathematica
    (*returns true if all but the last digit of n is even, false o.w.*) f[n_] := Module[{a, l, i, r = True}, a = IntegerDigits[n]; l = Length[a]; For[i = 1, i < l, i++, If[Mod[a[[i]], 2] == 1, r = False; Break[ ]]]; r]; Select[Range[1, 4*10^3], PrimeQ[ # ] && f[ # ] &]
    m = 7; Prepend[Reap[Do[If[PrimeQ[fd = FromDigits[{a[1], a[2], a[3], a[4], a[5], a[6], a[m]}]], Sow[fd]], {a[1], 0, 8, 2}, {a[2], 0, 8, 2}, {a[3], 0, 8, 2}, {a[4], 0, 8, 2}, {a[5], 0, 8, 2}, {a[6], 0, 8, 2}, {a[m], 1, 9, 2}]][[2, 1]], 2] (* all terms < 10^8. Zak Seidov, Jan 29 2013 *)
    Select[ Prime@ Range[10000], ContainsAll[{0, 2, 4, 6, 8}, Most@ IntegerDigits[#]] &] (* From version 10. Mikk Heidemaa, Feb 08 2016 *)
    Select[Prime[Range[400]],AllTrue[Most[IntegerDigits[#]],EvenQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Sep 18 2019 *)

Extensions

Definition rephrased by N. J. A. Sloane, Dec 11 2007

A104638 Number of odd digits in n-th prime.

Original entry on oeis.org

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

Views

Author

Zak Seidov, Mar 18 2005

Keywords

Comments

The only zero is the first term. Sequence is unbounded. - Zak Seidov, Jan 12 2016
From Robert Israel, Jan 12 2016: (Start)
For any N, the asymptotic density of terms >= N is 1.
On the other hand, a(n) = 2 if prime(n) is in A159352, which is conjectured to be infinite.
Record values: a(2) = 1, a(5) = 2, a(30) = 3, a(187) = 4, a(1346) = 5, a(10545) = 6, a(86538) = 7, a(733410) = 8.
(End)

Crossrefs

Cf. A154764 (1 odd digit), A155071 (2 odd digits), A030096 (all digits odd).

Programs

  • Maple
    seq(nops(select(type, convert(ithprime(i),base,10),odd)),i=1..100); # Robert Israel, Jan 12 2016
    # alternative
    A104638 := proc(n)
        local a,dgs,d ;
        ithprime(n) ;
        dgs := convert(%,base,10) ;
        a := 0 ;
        for d in dgs do
            a := a+modp(d,2) ;
        end do:
        a ;
    end proc:
    seq(A104638(n),n=1..40) ; # R. J. Mathar, Jul 13 2025
  • Mathematica
    Table[Count[IntegerDigits[Prime[n]],?OddQ],{n,100}] (* _Harvey P. Dale, Jan 22 2012 *)
    Table[Total[Mod[IntegerDigits[Prime[n]], 2]], {n, 100}] (* Vincenzo Librandi, Jan 13 2016 *)
  • PARI
    a(n)=vecsum(digits(prime(n)%2)) \\ Zak Seidov, Jan 12 2016

Formula

a(n) = A196564(A000040(n)). - Michel Marcus, Oct 05 2013

A320256 k-digit primes with the same even digit repeated k-1 times and a single odd digit.

Original entry on oeis.org

3, 5, 7, 23, 29, 41, 43, 47, 61, 67, 83, 89, 223, 227, 229, 443, 449, 661, 881, 883, 887, 2221, 4441, 4447, 6661, 8887, 22229, 44449, 88883, 444443, 444449, 666667, 888887, 22222223, 66666667, 88888883, 222222227, 444444443, 666666667, 888888883, 888888887
Offset: 1

Views

Author

Enrique Navarrete, Oct 08 2018

Keywords

Comments

For the resulting number to be prime, the rightmost digit must be the odd one. - Michel Marcus, Oct 11 2018

Examples

			3, 5, 7 are in the sequence for k = 1.
229 is in the sequence because it is a 3-digit prime with the first 3-1 digits repeating even (2) and the last digit odd (9). - _David A. Corneth_, Oct 10 2018
		

Crossrefs

Programs

  • Mathematica
    Join[{3, 5, 7}, Select[Flatten@ Table[{1, 3, 7, 9} + 10 FromDigits@ ConstantArray[k, n], {n, 9}, {k, Range[2, 8, 2]}], PrimeQ]] (* Michael De Vlieger, Oct 31 2018 *)
  • PARI
    first(n) = {n = max(n, 3); my(t = 3, res = List([3, 5, 7])); print1("3, 5, 7, "); for(i=1, oo, k=(10^i - 1) / 9; forstep(f = 2, 8, 2, forstep(d=1, 9, 2, c = 10 * f * k + d; if(isprime(c), print1(c", "); listput(res, c); t++; if(t>=n, return(res))))))} \\ David A. Corneth, Oct 10 2018

Extensions

More terms from Michel Marcus, Oct 10 2018

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-4 of 4 results.