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.

Previous Showing 21-30 of 54 results. Next

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

A104640 Number of odd digits in n^3.

Original entry on oeis.org

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

Views

Author

Zak Seidov, Mar 18 2005

Keywords

Crossrefs

Programs

Formula

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

A065031 In the decimal expansion of n, replace each odd digit with 1 and each even digit with 2.

Original entry on oeis.org

2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21
Offset: 0

Views

Author

Santi Spadaro, Nov 03 2001

Keywords

Comments

A196563(a(n)) = A196563(n); A196564(a(n)) = A196564(n).

Examples

			a(123)=121 because 1 and 3 are odd and 2 is even.
		

Programs

  • Haskell
    a065031 n = f n  where
       f x | x < 10    = 2 - x `mod` 2
           | otherwise = 10 * (f x') + 2 - m `mod` 2
           where (x',m) = divMod x 10
    -- Reinhard Zumkeller, Feb 22 2012
  • Mathematica
    Table[FromDigits[If[OddQ[#],1,2]&/@IntegerDigits[n]],{n,0,120}] (* Harvey P. Dale, Jun 08 2014 *)

A102681 Number of digits >= 8 in decimal representation of n.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Feb 03 2005

Keywords

Comments

a(n) = 0 iff n is in A007094 (numbers in base 8). - Bernard Schott, Feb 18 2023

Crossrefs

Programs

  • Maple
    p:=proc(n) local b,ct,j: b:=convert(n,base,10): ct:=0: for j from 1 to nops(b) do if b[j]>=8 then ct:=ct+1 else ct:=ct fi od: ct: end: seq(p(n),n=0..120); # Emeric Deutsch, Feb 23 2005

Formula

From Hieronymus Fischer, Jun 10 2012: (Start)
a(n) = Sum_{j=1..m+1} (floor(n/10^j + 1/5) - floor(n/10^j)), where m = floor(log_10(n)).
G.f.: g(x) = (1/(1-x))*Sum_{j>=0} (x^(8*10^j) - x^(10*10^j))/(1 - x^10^(j+1)). (End)

Extensions

More terms from Emeric Deutsch, Feb 23 2005

A338741 When a(n) is odd, a(n) is the number of odd digits present so far in the sequence, a(n) included.

Original entry on oeis.org

0, 1, 2, 4, 6, 8, 10, 3, 12, 5, 14, 7, 16, 9, 11, 13, 15, 17, 18, 20, 22, 24, 26, 28, 30, 32, 21, 34, 23, 36, 25, 38, 27, 40, 42, 44, 46, 48, 50, 29, 31, 33, 35, 37, 39, 52, 41, 54, 43, 56, 45, 58, 47, 60, 62, 64, 66, 68, 70, 49, 51, 53, 55, 57, 59, 72, 61, 74, 63, 76, 65, 78, 67, 80, 82, 84, 86, 88, 90, 69
Offset: 1

Views

Author

Eric Angelini and Carole Dubois, Nov 06 2020

Keywords

Comments

The even nonnegative integers are present in their natural order. Some odd natural integers will never appear (19 for instance).

Examples

			The first odd term is a(2) = 1 and there is indeed 1 odd digit so far in the sequence (1 itself);
The next odd term is a(8) = 3 and there are now 3 odd digits so far (1, 1 and 3);
The next odd term is a(10) = 5 and there are now 5 odd digits so far (1, 1, 3, 1 and 5);
...
The next odd term is a(18) = 17 and there are indeed 17 odd digits so far in the sequence (1, 1, 3, 1, 5, 1, 7, 1, 9, 1, 1, 1, 3, 1, 5, 1, 7); etc.
		

Crossrefs

Cf. A338742, A338743, A338744, A338745, A338746 (variants on the same idea), A196564.

Programs

  • Mathematica
    Block[{a = {0}, c = 0}, Do[Block[{k = 1, s}, While[If[OddQ[k], Nand[FreeQ[a, k], k == c + Set[s, Total@ DigitCount[k, 10, {1, 3, 5, 7, 9}]]], ! FreeQ[a, k]], k++]; If[OddQ[k], c += s, c += Total@ DigitCount[k, 10, {1, 3, 5, 7, 9}]]; AppendTo[a, k]], {i, 79}]; a] (* Michael De Vlieger, Nov 06 2020 *)

A338744 When a(n) is even, a(n) is the number of odd digits present so far in the sequence, a(n) included.

Original entry on oeis.org

0, 1, 3, 2, 5, 7, 4, 9, 11, 13, 10, 15, 17, 19, 21, 18, 23, 25, 20, 27, 29, 22, 31, 24, 33, 26, 35, 28, 37, 39, 41, 34, 43, 36, 45, 38, 47, 49, 40, 51, 42, 53, 44, 55, 46, 57, 48, 59, 61, 52, 63, 54, 65, 56, 67, 58, 69, 71, 73, 75, 77, 79, 70, 81, 72, 83, 74, 85, 76, 87, 78, 89, 91, 93, 95, 97, 99, 90, 101
Offset: 1

Views

Author

Eric Angelini and Carole Dubois, Nov 06 2020

Keywords

Comments

The odd nonnegative integers are present in their natural order. Some even natural integers will never appear (6 for instance).

Examples

			The first even term is a(1) = 0 and there is indeed 0 odd digit so far in the sequence;
The next even term is a(4) = 2 and there are now 2 odd digits so far (1 and 3);
The next even term is a(7) = 4 and there are now 4 odd digits so far (1, 3, 5 and 7);
...
The even term a(11) = 10 and there are indeed 10 odd digits in the sequence so far (1, 3, 5, 7, 9, 1, 1, 1, 3 and 1); etc.
		

Crossrefs

Cf. A338741, A338742, A338743, A338745, A338746 (variants on the same idea), A196564.

Programs

  • Mathematica
    Block[{a = {0}, c = 0}, Do[Block[{k = 1, s}, While[If[EvenQ[k], Nand[FreeQ[a, k], k == c + Set[s, Total@ DigitCount[k, 10, {1, 3, 5, 7, 9}]]], ! FreeQ[a, k]], k++]; If[EvenQ[k], c += s, c += Total@ DigitCount[k, 10, {1, 3, 5, 7, 9}]]; AppendTo[a, k]], {i, 78}]; a] (* Michael De Vlieger, Nov 06 2020 *)

A102677 Number of digits >= 6 in decimal representation of n.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Feb 03 2005

Keywords

Comments

a(n) = 0 iff n is in A007092 (numbers in base 6). - Bernard Schott, Feb 02 2023

Crossrefs

Programs

  • Maple
    p:=proc(n) local b,ct,j: b:=convert(n,base,10): ct:=0: for j from 1 to nops(b) do if b[j]>=6 then ct:=ct+1 else ct:=ct fi od: ct: end: seq(p(n),n=0..116); # Emeric Deutsch, Feb 23 2005
  • Mathematica
    Table[Total@ Take[Most@ DigitCount@ n, -4], {n, 0, 104}] (* Michael De Vlieger, Aug 17 2017 *)

Formula

From Hieronymus Fischer, Jun 10 2012: (Start)
a(n) = Sum_{j=1..m+1} (floor(n/10^j + 2/5) - floor(n/10^j)), where m = floor(log_10(n)).
G.f.: g(x) = (1/(1-x))*Sum_{j>=0} (x^(6*10^j) - x^(10*10^j))/(1-x^10^(j+1)). (End)

Extensions

More terms from Emeric Deutsch, Feb 23 2005

A352547 Numbers having more odd than even digits when written in base 10.

Original entry on oeis.org

1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 31, 33, 35, 37, 39, 51, 53, 55, 57, 59, 71, 73, 75, 77, 79, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 121, 123, 125, 127, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 141, 143, 145, 147, 149, 150, 151, 152, 153, 154, 155
Offset: 1

Views

Author

M. F. Hasler, Jul 03 2022

Keywords

Crossrefs

Cf. A072600 (same in base 2).
Cf. A227870, A352546 (numbers with fewer odd than even decimal digits).

Programs

  • Mathematica
    A352547Q[k_] := Length[#] < 2*Count[#, _?OddQ] &[IntegerDigits[k]];
    Select[Range[300], A352547Q] (* Paolo Xausa, Nov 28 2024 *)
  • PARI
    select( {is_A352547(n)=vecsum(n=digits(n)%2)*2>#n}, [0..155])
    
  • Python
    def ok(n): return len(s:=str(n)) > 2*sum(1 for c in s if c in "02468")
    print([k for k in range(156) if ok(k)]) # Michael S. Branicky, Jul 03 2022

A007957 Numbers that contain an odd digit.

Original entry on oeis.org

1, 3, 5, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 23, 25, 27, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 41, 43, 45, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 61, 63, 65, 67, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 81, 83, 85, 87, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100
Offset: 1

Views

Author

R. Muller

Keywords

Comments

Complement of A014263; A196564(a(n)) > 0; A103181(a(n)) > 0. - Reinhard Zumkeller, Oct 04 2011

Crossrefs

Programs

  • Haskell
    import Data.List (findIndices)
    a007957 n = a007957_list !! (n-1)
    a007957_list = findIndices (> 0) a196564_list
    a196564 n = length [d | d <- show n, d `elem` "13579"]
    a196564_list = map a196564 [0..]
    -- Reinhard Zumkeller, Oct 04 2011
    
  • Mathematica
    Select[Range[100],Count[IntegerDigits[#],?OddQ]>0&] (* _Harvey P. Dale, Sep 06 2017 *)
  • PARI
    is(n)=my(v=vecsort(eval(Vec(Str(n)))%2,,8));v[#v] \\ Charles R Greathouse IV, Jul 25 2012

Formula

a(n) = n + O(n^0.69897...) where the constant is A153268. - Charles R Greathouse IV, Jul 25 2012

A102684 Number of times the digit 9 appears in the decimal representations of all integers from 0 to n.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20
Offset: 0

Views

Author

N. J. A. Sloane, Feb 03 2005

Keywords

Comments

This is the total number of digits = 9 occurring in all the numbers 0, 1, 2, ... n (in decimal representation). - Hieronymus Fischer, Jun 10 2012

Crossrefs

Programs

  • Maple
    p:=proc(n) local b,ct,j: b:=convert(n,base,10): ct:=0: for j from 1 to nops(b) do if b[j]>=9 then ct:=ct+1 else ct:=ct fi od: ct: end: seq(add(p(i),i=0..n), n=0..105); # Emeric Deutsch, Feb 23 2005
  • Mathematica
    Accumulate[DigitCount[Range[0,100],10,9]] (* Harvey P. Dale, Mar 30 2018 *)
  • PARI
    a(n) = sum(k=0, n, #select(x->(x==9), digits(k))); \\ Michel Marcus, Oct 03 2023

Formula

From Hieronymus Fischer, Jun 10 2012: (Start)
a(n) = (1/2)*Sum_{j=1..m+1} (floor(n/10^j + 1/10)*(2n + 2 - (4/5 + floor(n/10^j + 1/10))*10^j) - floor(n/10^j)*(2n + 2 - (1+floor(n/10^j)) * 10^j)), where m = floor(log_10(n)).
a(n) = (n+1)*A102683(n) + (1/2)*Sum_{j=1..m+1} ((-4/5*floor(n/10^j + 1/10) + floor(n/10^j))*10^j - (floor(n/10^j + 1/10)^2 - floor(n/10^j)^2)*10^j), where m = floor(log_10(n)).
a(10^m-1) = m*10^(m-1).
(this is total number of digits = 9 occurring in all the numbers with <= m places).
G.f.: g(x) = (1/(1-x)^2)*Sum_{j>=0} (x^(9*10^j) - x^(10*10^j))/(1-x^10^(j+1)). (End)

Extensions

More terms from Emeric Deutsch, Feb 23 2005
Definition revised by N. J. A. Sloane, Mar 30 2018
Previous Showing 21-30 of 54 results. Next