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.

A358854 Number of even digits necessary to write all the numbers from 0 up to n.

Original entry on oeis.org

1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 12, 13, 15, 16, 18, 19, 21, 22, 24, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 32, 33, 35, 36, 38, 39, 41, 42, 44, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 52, 53, 55, 56, 58, 59, 61, 62, 64, 65, 66, 66, 67, 67, 68, 68
Offset: 0

Views

Author

Bernard Schott, Dec 03 2022

Keywords

Comments

Inspired by problem 1 of British Mathematical Olympiad, round 1, in 2016/2017 (link).

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<0, 0, a(n-1)+
          nops(select(x-> x::even, convert(n, base, 10))))
        end:
    seq(a(n), n=0..100);  # Alois P. Heinz, Feb 19 2023
  • Mathematica
    Accumulate[Table[Count[IntegerDigits[n], ?EvenQ], {n, 0, 100}]] (* _Amiram Eldar, Dec 03 2022 *)
  • Python
    from itertools import accumulate, count, islice
    def A196563(n): return sum(1 for d in str(n) if d in "02468")
    def agen(): yield from accumulate(A196563(n) for n in count(0))
    print(list(islice(agen(), 76))) # Michael S. Branicky, Dec 03 2022

Formula

a(n) = A117804(n+1) - A279766(n) (number of total digits - number of odd digits).
a(n) = Sum_{k=0..n} A196563(k).

A359271 Number of odd digits necessary to write all nonnegative n-digit integers.

Original entry on oeis.org

5, 95, 1400, 18500, 230000, 2750000, 32000000, 365000000, 4100000000, 45500000000, 500000000000, 5450000000000, 59000000000000, 635000000000000, 6800000000000000, 72500000000000000, 770000000000000000, 8150000000000000000
Offset: 1

Views

Author

Bernard Schott, Dec 23 2022

Keywords

Examples

			To write the integers from 10 up to 99, each of the digits 1, 3, 5, 7 and 9, must be used 19 times, hence a(2) = 19*5 = 95.
		

Crossrefs

Programs

  • Maple
    seq(5 * (9*n+1) * 10^(n-2), n=1..18);
  • Mathematica
    a[n_] := 5*(9*n + 1)*10^(n - 2); Array[a, 20] (* Amiram Eldar, Dec 23 2022 *)

Formula

a(n) = 5 * (9*n+1) * 10^(n-2).
a(n) = A279766(10^n-1) - A279766(10^(n-1)-1).
a(n) = A113119(n) - A358439(n).
From Stefano Spezia, Dec 24 2022: (Start)
O.g.f.: 5*x*(1 - x)/(1 - 10*x)^2.
E.g.f.: (exp(10*x)*(1 + 90*x) - 1)/20. (End)
Showing 1-2 of 2 results.