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.

A343839 Semi-one numbers: Positive integers k such that exactly half of the integers 1..k have a 1 in their decimal expansion.

Original entry on oeis.org

2, 16, 24, 160, 270, 272, 1456, 3398, 3418, 3420, 3422, 13120, 44686, 118096, 674934, 1062880
Offset: 1

Views

Author

Adam Atkinson, May 01 2021

Keywords

Comments

There are only these 16 semi-one numbers. That there can only be finitely many is fairly easy to show: consider how many 100-billion-digit numbers have no 1s in them. Eventually the proportion of 1-less numbers drops below 50% and stays there. 5217031 numbers up to 9999999 have a 1 in them so proportion of 1-ful numbers can't drop below 50% for numbers with more digits. Hence the search program can stop at 10 million.

Examples

			16 is semi-1 because 1,10,11,12,13,14,15,16 have a 1 in them, there are 8 such numbers, and 8 is half of 16. 2 is semi-1 because 1 has a 1 in it and 2 does not.
		

Crossrefs

Programs

  • Mathematica
    s = {}; c = 0; Do[If[DigitCount[n, 10, 1] > 0, c++]; If[n == 2*c, AppendTo[s, n]], {n, 1, 1062880}]; s (* Amiram Eldar, May 01 2021 *)
    With[{nn=11*10^5},Select[Partition[Riffle[Range[nn],Accumulate[Table[If[DigitCount[n,10,1]>0,1,0],{n,nn}]]],2],#[[1]]==2#[[2]]&]][[;;,1]] (* Harvey P. Dale, Jun 23 2023 *)
  • PARI
    lista(nn) = {my(va = vector(nn)); va[1] = 1; for (n=2, #va, va[n] = va[n-1] + (#select(x->(x==1), digits(n)) > 0);); for (n=1, nn, if (va[n] == n/2 , print1(n, ", ")););} \\ Michel Marcus, May 02 2021
  • Perl
    for (1..10000000) {
            if (/1/) {
                    $s++;
                    }
            if ($_==2*$s) {
                    print $_."\n";
                    }
            }
    

A344474 Least number k such that half of the numbers from 0 to k inclusive contain the digit n.

Original entry on oeis.org

1, 1, 2915, 39365, 472391, 590489, 6377291, 7440173, 8503055, 9565937
Offset: 0

Views

Author

Glen Gilchrist, May 20 2021

Keywords

Comments

"Half-numbers" are those for which half of the numbers including and preceding it contain a specific digit.
For each digit there are a finite number of nonnegative integers k such that exactly half of the numbers from 0 to k contain the digit. This sequence gives the first of these.

Examples

			a(0)=1 since among the numbers 0,1 exactly half contain a digit "0" and 1 is the smallest number where this occurs.
a(1)=1 since among the numbers 0,1 exactly half contain a digit "1" and 1 is the smallest number where this occurs.
a(2)=2915 since among the numbers 0,1,2,...,2915 exactly half contain a digit "2" and 2915 is the smallest number where this occurs.
a(3)=39365 since among the numbers 0,1,2,...,39365 exactly half contain a digit "3" and 39365 is the smallest number where this occurs.
		

References

  • Andrew Hilton, 101 Puzzles to Solve on your Microcomputer, 1984, HARRAP, page 57.

Crossrefs

Cf. A016189, A344634 (half-zero sequence), A344636 (half-one sequence).

Programs

  • PARI
    a(n)={if(n>=1&&n<10, my(k=0); while(n*(2*9^k-10^k)>10^k, k++); 2*9^k*n - 1, n==0)} \\ Andrew Howroyd, May 25 2021
  • Python
    for z in range (0, 10):
        z_s = str(z)
        counts=0
        for x in range (0,1000000000):
            x_s = str(x)
            if z_s in x_s:
                counts += 1
            if counts / (x+1) == 0.5:
                print(x)
                break
    

Formula

a(n) == 1457 (mod 1458) for n >= 2. - Hugo Pfoertner, May 25 2021

A344634 Numbers k such that half the numbers from 0 to k inclusive contain the digit "0".

Original entry on oeis.org

1, 10761677, 14958585, 14960717, 14961735, 15013205, 15588833, 15590573, 15591959, 15591961, 15592031, 15592229, 15592231, 15603695, 15633495, 15633503, 15633517, 16076087, 16263743, 20327615
Offset: 1

Views

Author

Glen Gilchrist, May 25 2021

Keywords

Comments

Andrew Hilton (see Ref.) refers to these as "half-zero" numbers.

Examples

			1 is a term since among the numbers 0,1 exactly half contain a digit "0".
10761677 is a term since among the numbers 0,1,2,...,10761677 exactly half contain a digit "0".
		

References

  • Andrew Hilton, 101 Puzzles to Solve on your Microcomputer, 1984, HARRAP, page 57.

Crossrefs

Programs

  • Python
    def afind(limit):
      count0 = [0, 1]
      for k in range(1, limit+1):
        count0['0' in str(k)] += 1
        if count0[0] == count0[1]: print(k, end=", ")
    afind(3*10**7) # Michael S. Branicky, May 25 2021

A346685 a(n) is the smallest positive integer k such that for all x >= k, at least 50% of the integers in the range 1..x contain n in their decimal expansion. In other words, it is the largest integer k such that exactly half of the integers 1..k have n in their decimal expansion.

Original entry on oeis.org

20327616, 1062880, 2125762, 3188644, 4251526, 5314408, 6377290, 17006110, 18068992, 19131874
Offset: 0

Views

Author

John Mason, Jul 29 2021

Keywords

Comments

The sequence is inspired by the fact that, for any string of decimal digits, s, "almost all" integers contain s in their decimal expansion. (The same is true for other bases.)

Examples

			a(1) = 1062880 because exactly half of the integers in [1..1062880] have a 1 in their decimal expansion.
		

Crossrefs

Also, this sequence has several values that coincide with values in A117862.
Showing 1-4 of 4 results.