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 11-20 of 30 results. Next

A094798 Number of times 1 is used in writing out all the numbers 1 through n.

Original entry on oeis.org

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

Views

Author

Lekraj Beedassy, Jun 11 2004

Keywords

Comments

The number of 1's required to write all integers of n or fewer digits (i.e., the sequence a(9), a(99), a(999), ...) is 1, 20, 300, 4000, ..., which is A053541. - Jason D. W. Taff (jtaff(AT)jburroughs.org), Dec 05 2004
A014778 gives the fixed points. - David Wasserman, Feb 22 2005
Partial sums of A268643. - Robert Israel, Oct 28 2016

Crossrefs

Programs

  • Maple
    nones:=proc(n) local nn,c,j: nn:=convert(n,base,10): c:=0: for j to nops(nn) do if nn[j]=1 then c:=c+1 else end if end do: c end proc: a:=proc(n) options operator, arrow: add(nones(k),k=1..n) end proc: seq(a(n),n=1..75); # Emeric Deutsch, Mar 01 2008
    ListTools:-PartialSums([seq(numboccur(1,convert(n,base,10)),n=1..100)]); # Robert Israel, Oct 28 2016
  • Mathematica
    Accumulate[Table[DigitCount[n,10,1],{n,80}]] (* Harvey P. Dale, Sep 27 2013 *)
  • PARI
    a(n) = sum(k=1, n, #select(x->(x==1), digits(k))); \\ Michel Marcus, Oct 03 2023
  • Python
    from itertools import accumulate, count, islice
    def f(, n): return  + str(n).count("1")
    def agen(): yield from accumulate(count(1), f)
    print(list(islice(agen(), 75))) # Michael S. Branicky, Aug 09 2022
    

Formula

G.f. g(x) satisfies g(x) = x/((1-x)*(1-x^10)) + ((1-x^10)/(1-x))^2*g(x^10). - Robert Israel, Oct 28 2016 [corrected by Fabio Visonà, Aug 10 2022]

A014886 n is equal to the number of 2's in all numbers <= n written in base 8.

Original entry on oeis.org

679922, 679923, 679924, 679925, 679926, 679927, 679928, 679929, 1048576, 16777216, 17457138, 17457139, 17457140, 17457141, 17457142, 17457143, 17457144, 17457145, 17825792
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A014778.

Programs

  • Perl
    ($s,$t,$u)=(0,'1',1); while($s <= $u*8){print "$u " if $s == $u; ($p,$o)=
    
  • Perl
    (1,0); $q=($t =~ /^(7*)/ && length $1); $r=length($t)+1; ++$o, $p *= 8 while
    
  • Perl
    $o+1 <= $q && $p*$r*8 <= abs($u-$s); $u += $p; s/^(7*)(.)?/(0 x length($1))
    
  • Perl
     ($2+1)/e, $s += tr/2/2/*$p + $o*$p/8 for substr $t,$o } print "\n"

Extensions

More terms and Perl program from Hugo van der Sanden
Comment from Hugo van der Sanden: Program terminates at n = 2.94239143846251e+56, when 2.37843307942386e+57 2's have been seen; since s > 8n and n > 8^8 at this point, it is not possible for n ever again to catch up with the sum (given s(8^n) = n 8^{n-1}).

A094799 First term of a run of 10 consecutive numbers such that for each m in the 10-tuple exactly m 1's are used in writing out all numbers 1 through m.

Original entry on oeis.org

199981, 1599981, 35199981, 500199981, 501599981, 535199981
Offset: 1

Views

Author

Lekraj Beedassy, Jun 11 2004

Keywords

Comments

The sequence is complete. - David Wasserman, Jun 29 2007

References

  • M. Protat, Des Olympiades a l'Agregation, Nombre de "1", Problem 89, pp. 182-183, Ellipses, Paris 1997.

Crossrefs

Cf. A014778.
Cf. A094798.

A163500 a(n) is the smallest number x > 1 such that n appears as a substring of the decimal representations of the numbers [0..x] exactly x times.

Original entry on oeis.org

199981, 28263827, 371599983, 499999984, 10000000000, 9500000000, 9465000000, 9465000000, 10000000000
Offset: 1

Views

Author

Gregory Marton, Jul 29 2009, Aug 12 2009

Keywords

Comments

This is an extension of a puzzle that a student posed as: Let f(x) be a function that counts the times the digit 1 appears in the decimal representations of the numbers from 0 to x. So, for example, f(11) is 4. For what number > 1 does f(x) = x? The answer to that question is 199981, the first term of this sequence. The sequence is the natural extension of this property. a(0) doesn't exist, because for any x, [0..x] (inclusive) contains zero, meaning there is at least one matching substring, and this is a monotonically increasing function. It is not clear that a(n) is defined for all n > 0, though the related sequence which uses f(x) > x rather than f(x) = x has at least less of a feeling of caprice about it. Multidigit numbers n are clearly at a disadvantage, but I have tried to phrase it, "appears as a substring" so that, for example, 11 appears in 1111 thrice rather than twice.
a(10) <= 10^92 + 10^91 - 190. - Giovanni Resta, Aug 13 2019

Crossrefs

See also A164321 which uses > instead of =. The first nine terms are contained in the sequences 1: A014778, 2: A101639, 3: A101640, 4:A101641, 5: A130427, 6: A130428, 7: A130429, 8: A130430, 9: A130431.

Programs

  • mzscheme
    (define (count-matches re str start-pos) (let ((m (regexp-match-positions re str start-pos))) (if m (+ 1 (count-matches re str (+ (caar m) 1))) 0))) (define (matches-n-in-zero-to-k fn n) (do ((sum-so-far 1) (k (+ n 1)) (re (regexp (format "~a" n)))) ((fn sum-so-far k) k) (when (equal? 0 (modulo k 1000000)) ;; this is just a progress indicator (display (format "~a ~a ~a\n" n k sum-so-far))) (set! k (+ k 1)) (set! sum-so-far (+ sum-so-far (count-matches re (format "~a" k) 0))))) (define (s f n) (display (matches-n-in-zero-to-k f n))) ;; where f should be one of = or > depending on which sequence you care about. ;; this could be made much more efficient, of course. In particular, the ;; initial sequences up to the first x of m digits have serious regularity.

Extensions

a(5)-a(9) added by Gregory Marton, Aug 12 2009
Donovan Johnson pointed out the 6th term was incorrect, Nov 01 2010

A216400 Numbers k such that the number of times digit 'm' used for writing the decimal representation between 1 to k is equal to k for at least one value of m in the range m = 1 to 9.

Original entry on oeis.org

0, 1, 199981, 199982, 199983, 199984, 199985, 199986, 199987, 199988, 199989, 199990, 200000, 200001, 1599981, 1599982, 1599983, 1599984, 1599985, 1599986, 1599987, 1599988, 1599989, 1599990, 2600000, 2600001, 13199998, 28263827, 35000000, 35000001, 35199981
Offset: 1

Views

Author

V. Raman, Sep 06 2012

Keywords

Crossrefs

Formula

A014884 n is equal to the number of 1's in all numbers <= n written in base 9.

Original entry on oeis.org

1, 102772, 102773, 102774, 102775, 102776, 102777, 102778, 102779, 102780, 142155, 142156, 737002, 737003, 737004, 737005, 737006, 737007, 737008, 737009, 737010, 1594323, 1594324, 1697095, 1697096, 1697097, 1697098
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A014778.

Programs

  • Maple
    T:= 0: R:= NULL:
    for n from 1 to 6*10^6 do
      T:= T + numboccur(1,convert(n,base,9));
      if T = n then R:= R, n fi
    od:
    R; # Robert Israel, Dec 01 2020

A094800 First term of a run of exactly two consecutive numbers such that for each m in the run, exactly m 1's are used in writing out all numbers 1 through m.

Original entry on oeis.org

0, 200000, 2600000, 35000000, 35200000, 500000000, 500200000, 502600000, 535000000, 535200000
Offset: 1

Views

Author

Lekraj Beedassy, Jun 11 2004

Keywords

Comments

Numbers n such that n and n+1 are members of A014778, but n-1 and n+2 are not. - David Wasserman

References

  • M. Protat, Des Olympiades a l'Agregation, Nombre de "1", Problem 89, pp. 182-183, Ellipses, Paris 1997.

Crossrefs

Extensions

Corrected by David Wasserman, Jun 29 2007. There are no further terms.

A165617 a(n) is the number of positive integers k such that k is equal to the number of 1's in the digits of the base-n expansion of all positive integers <= k.

Original entry on oeis.org

2, 4, 8, 4, 21, 5, 45, 49, 83, 10, 269, 11, 202, 412, 479, 15, 1108, 15, 1545, 1219, 1343, 21, 8944, 706, 1043, 5077, 4084, 28, 27589, 27, 32160, 10423, 6689
Offset: 2

Views

Author

Martin J. Erickson (erickson(AT)truman.edu), Sep 22 2009

Keywords

Comments

The greatest number counted by a(n) is 1...10, where the number of 1's is n-1. - Martin J. Erickson (erickson(AT)truman.edu), Oct 08 2010
These numbers, described in previous comment, 10(2), 110(3), 1110(4), ... expressed in base 10 are: 2, 12, 84, 780, 9330, 137256, 2396744, 48427560, 1111111110, ... - Michel Marcus, Aug 20 2013
The sequence described in the previous two comments is A226238. - Ralf Stephan, Aug 25 2013

Examples

			a(3)=4 since there are four values of k such that k is equal to the number of 1's in the digits of the base-3 expansion of all numbers <= k, namely, 1, 4, 5, 12.
From _Jon E. Schoenfield_, Apr 23 2023: (Start)
In the table below, an asterisk appears on each row k at which the cumulative count of 1's in the base-3 expansion of the positive integers 1..k is equal to k:
.
       k      #1's  cume
  ----------  ----  ----
   1 =   1_3    1     1*
   2 =   2_3    0     1
   3 =  10_3    1     2
   4 =  11_3    2     4*
   5 =  12_3    1     5*
   6 =  20_3    0     5
   7 =  21_3    1     6
   8 =  22_3    0     6
   9 = 100_3    1     7
  10 = 101_3    2     9
  11 = 102_3    1    10
  12 = 110_3    2    12*
(End)
		

Crossrefs

Programs

  • Mathematica
    nn = 7; Table[c = q = 0; Do[c += DigitCount[i, n, 1]; If[c == i, q++], {i, (#^# - #)/(# - 1) &[n]}]; q, {n, 2, nn}] (* Michael De Vlieger, May 24 2023 *)
  • PARI
    a(n) = {my(nmax = (n^n - 1)/(n - 1) - 1, s = 0, nb = 0); for (i=1, nmax, my(digs = digits(i, n)); s += sum (k=1, #digs, (digs[k] == 1)); if (s == i, nb++);); nb;} \\ Michel Marcus, Aug 20 2013; corrected Apr 23 2023

Extensions

Example corrected by Martin J. Erickson (erickson(AT)truman.edu), Sep 25 2009
Definition and a(10) corrected by Tanya Khovanova, Apr 23 2023
a(11)-a(35) from Gregory Marton, Jul 29 2023

A216398 For digit n from 1 to 9, a(n) = the sum of all numbers m such that m is equal to the number of n's in the decimal digits of all numbers <= m.

Original entry on oeis.org

22786974071, 73737982962, 372647999625, 741999999540, 100000000000, 2434703999430, 1876917059570, 15312327487352, 360000000000
Offset: 1

Views

Author

V. Raman, Sep 06 2012

Keywords

Comments

Closely related to A130432. - N. J. A. Sloane, Sep 07 2012

Crossrefs

A216399 Numbers k such that the number of times digit 'm' used for writing the decimal representation of the numbers from 1 to k is equal to k for more than one value of m in the range m = 1 to 9.

Original entry on oeis.org

0, 35000000, 500000000, 535000000, 9465000000, 9500000000, 9965000000, 10000000000, 10500000000, 19465000000, 19500000000, 19965000000, 20000000000, 20500000000, 29465000000, 29500000000, 29965000000
Offset: 1

Views

Author

V. Raman, Sep 06 2012

Keywords

Comments

Related to A216398.

Crossrefs

Previous Showing 11-20 of 30 results. Next