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

A055642 Number of digits in the decimal expansion of n.

Original entry on oeis.org

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

Views

Author

Henry Bottomley, Jun 06 2000

Keywords

Comments

From Hieronymus Fischer, Jun 08 2012: (Start)
For n > 0 the first differences of A117804.
The total number of digits necessary to write down all the numbers 0, 1, 2, ..., n is A117804(n+1). (End)
Here a(0) = 1, but a different common convention is to consider that the expansion of 0 in any base b > 0 has 0 terms and digits. - M. F. Hasler, Dec 07 2018

Examples

			Examples:
999: 1 + floor(log_10(999)) = 1 + floor(2.x) = 1 + 2 = 3 or
      ceiling(log_10(999+1)) = ceiling(log_10(1000)) = ceiling(3) = 3;
1000: 1 + floor(log_10(1000)) = 1 + floor(3) = 1 + 3 = 4 or
      ceiling(log_10(1000+1)) = ceiling(log_10(1001)) = ceiling(3.x) = 4;
1001: 1 + floor(log_10(1001)) = 1 + floor(3.x) = 1 + 3 = 4 or
      ceiling(log_10(1001+1)) = ceiling(log_10(1002)) = ceiling(3.x) = 4;
		

Crossrefs

Programs

  • Haskell
    a055642 :: Integer -> Int
    a055642 = length . show  -- Reinhard Zumkeller, Feb 19 2012, Apr 26 2011
    
  • Magma
    [ #Intseq(n): n in [0..105] ];   //  Bruno Berselli, Jun 30 2011
    (Common Lisp) (defun A055642 (n) (if (zerop n) 1 (floor (log n 10)))) ; James Spahlinger, Oct 13 2012
    
  • Maple
    A055642 := proc(n)
            max(1,ilog10(n)+1) ;
    end proc:  # R. J. Mathar, Nov 30 2011
  • Mathematica
    Join[{1}, Array[ Floor[ Log[10, 10# ]] &, 104]] (* Robert G. Wilson v, Jan 04 2006 *)
    Join[{1},Table[IntegerLength[n],{n,104}]]
    IntegerLength[Range[0,120]] (* Harvey P. Dale, Jul 02 2016 *)
  • PARI
    a(n)=#Str(n) \\ M. F. Hasler, Nov 17 2008
    
  • PARI
    A055642(n)=logint(n+!n,10)+1 \\ Increasingly faster than the above, for larger n. (About twice as fast for n ~ 10^7.) - M. F. Hasler, Dec 07 2018
    
  • Python
    def a(n): return len(str(n))
    print([a(n) for n in range(121)]) # Michael S. Branicky, May 10 2022
    
  • Python
    def A055642(n): # Faster than len(str(n)) from ~ 50 digits on
        L = math.log10(n or 1)
        if L.is_integer() and 10**int(L)>n: return int(L or 1)
        return int(L)+1  # M. F. Hasler, Apr 08 2024

Formula

a(A046760(n)) < A050252(A046760(n)); a(A046759(n)) > A050252(A046759(n)). - Reinhard Zumkeller, Jun 21 2011
a(n) = A196563(n) + A196564(n).
a(n) = 1 + floor(log_10(n)) = 1 + A004216(n) = ceiling(log_10(n+1)) = A004218(n+1), if n >= 1. - Daniel Forgues, Mar 27 2014
a(A046758(n)) = A050252(A046758(n)). - Reinhard Zumkeller, Jun 21 2011
a(n) = A117804(n+1) - A117804(n), n > 0. - Hieronymus Fischer, Jun 08 2012
G.f.: g(x) = 1 + (1/(1-x))*Sum_{j>=0} x^(10^j). - Hieronymus Fischer, Jun 08 2012
a(n) = A262190(n) for n < 100; a(A262198(n)) != A262190(A262198(n)). - Reinhard Zumkeller, Sep 14 2015

A067175 Number of digits in the n-th primorial (A002110).

Original entry on oeis.org

1, 1, 1, 2, 3, 4, 5, 6, 7, 9, 10, 12, 13, 15, 17, 18, 20, 22, 24, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 56, 58, 60, 62, 64, 66, 69, 71, 73, 76, 78, 80, 82, 85, 87, 89, 92, 94, 97, 99, 101, 104, 106, 109, 111, 113, 116, 118, 121, 123, 126, 128, 131, 133
Offset: 0

Views

Author

Lekraj Beedassy, Feb 18 2002

Keywords

Crossrefs

Cf. A002110. Essentially the same as A048856.

Programs

  • Maple
    with(numtheory): it := 1: for n from 1 to 150 do it := it*ithprime(n): printf(`%d,`,ceil(log[10](it))) od:
  • Mathematica
    Table[Floor[Log[10, Product[Prime[k], {k, n}]] + 1], {n, 0, 67}]
    Join[{1},IntegerLength/@FoldList[Times,Prime[Range[70]]]] (* Harvey P. Dale, Jan 03 2024 *)
  • PARI
    a(n) = 1 + logint(vecprod(primes(n)), 10) \\ Andrew Howroyd, Apr 24 2021
    
  • Python
    from sympy import primorial
    def a(n): return 1 if n == 0 else len(str(primorial(n)))
    print([a(n) for n in range(68)]) # Michael S. Branicky, Apr 24 2021

Extensions

Edited and extended by Robert G. Wilson v and James Sellers, Feb 19 2002
Offset corrected by Arkadiusz Wesolowski, May 04 2013

A052038 First nonzero digit in expansion of 1/n.

Original entry on oeis.org

1, 5, 3, 2, 2, 1, 1, 1, 1, 1, 9, 8, 7, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 9, 9, 9, 9
Offset: 1

Views

Author

Patrick De Geest, Dec 15 1999

Keywords

Comments

The number of times each digit occurs for numbers < 10^k:
...\a(n)==1.........2.......3........4........5........6........7........8........9
10^k\
1.........5.........2........1........0........1........0........0........0........0
2........55........19........9........5........5........2........2........1........1
3.......555.......186.......92.......55.......39.......26.......19.......15.......12
4......5555......1853......925......555......373......264......197......154......123
5.....55555.....18520.....9258.....5555.....3707.....2645.....1982.....1543.....1234
6....555556....185187....92591....55555....37041....26454....19839....15432....12345
7...5555555...1851854...925924...555555...370375...264549...198410...154321...123456
8..55555555..18518521..9259257..5555555..3703709..2645501..1984124..1543210..1234567
9.555555555.185185188.92592590.55555555.37037043.26455025.19841266.15432099.12345678
...
Inf. ...5/9......5/27.....5/54.....5/90.....1/27........?........?........?........?

Crossrefs

Programs

  • Mathematica
    f[n_] := RealDigits[1/n, 10, 12][[1, 1]]; Array[f, 105]

Formula

a(n) = floor(10^floor(1+log_10(n-1))/n). After 10^k terms the number of times m will have appeared will be about 10^(k+1)/(9*m*(m+1)), e.g., 1 will appear just over 55.5% of the time. - Henry Bottomley, May 11 2001
a(n) = A000030(floor(A011557(k)/n)) for k >= A004218(n). - Reinhard Zumkeller, Feb 27 2011

A004230 a(n) = 10000*log_10(n) rounded up.

Original entry on oeis.org

0, 3011, 4772, 6021, 6990, 7782, 8451, 9031, 9543, 10000, 10414, 10792, 11140, 11462, 11761, 12042, 12305, 12553, 12788, 13011, 13223, 13425, 13618, 13803, 13980, 14150, 14314, 14472, 14624
Offset: 1

Views

Author

Keywords

Crossrefs

A176087 Numbers n such that (10^n-1)/3 * 10^ceiling(log_10(n+1)) + n is prime.

Original entry on oeis.org

1, 253, 35473
Offset: 1

Views

Author

Rick L. Shepherd, Apr 08 2010

Keywords

Comments

No term is a multiple of 2, 3, or 5. The decimal expansion of each corresponding prime is n 3's with n's decimal expansion concatenated. Probable primes found by PrimeForm. Prime for 253 proved by Primo. No more terms up to 50000.

Examples

			The first term is 1 because 31 is prime.
		

Crossrefs

Cf. A070746 (n 1's followed by n is prime), A084428 (n 7's followed by n is prime), A174710, A004218.

Programs

A004224 a(n) = 100*log_10(n) rounded up.

Original entry on oeis.org

0, 31, 48, 61, 70, 78, 85, 91, 96, 100, 105, 108, 112, 115, 118, 121, 124, 126, 128, 131, 133, 135, 137, 139, 140, 142, 144, 145, 147, 148, 150, 151, 152, 154, 155, 156, 157, 158, 160, 161, 162, 163, 164, 165
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    Ceiling[100 Log10[Range[50]]] (* Harvey P. Dale, Jun 05 2021 *)

A123119 Number of digits in sum of first n primes (A007504).

Original entry on oeis.org

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

Views

Author

Jonathan Vos Post, Sep 28 2006

Keywords

Comments

Since A007504(n) has the asymptotic expression ~ n^2 * log(n) / 2, a(n) has the asymptotic expression n^2 * log(n) / 2 = floor(log_10(10* n^2 * log(n) / 2)) = floor(log_10(5* n^2 * log(n))) = floor(log_10(5) + log_10(n^2) + log_10(log(n))) = floor(0.698970004 + 2*log_10(n) + log_10(log(n))). What is the smallest n such that a(n) = 5, 6, 7, ...?

Examples

			a(3) = 2 because 2 + 3 + 5 = 10 has 2 digits in its decimal expansion.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Floor[ Log[10, Sum[Prime@i, {i, n}]] + 1]; Array[f, 105] (* Robert G. Wilson v *)
    f[n_] := IntegerLength[Total[Prime[Range[n]]]]; Array[f, 105] (* Jan Mangaldan, Jan 04 2017 *)
    IntegerLength/@Accumulate[Prime[Range[110]]] (* Harvey P. Dale, Jan 26 2019 *)

Formula

a(n) = A055642(A007504(n)) = floor(log_10(10*A007504(n))) = A004216(A007504(n)) + 1 = A004218(A007504(n) + 1).

Extensions

More terms from Robert G. Wilson v, Oct 05 2006

A298486 Square array T(n, k), n >= 0, k >= 0, read by antidiagonals upwards: T(n, k) = the (k+1)-th nonnegative number m such that n + m can be computed with carry in decimal base.

Original entry on oeis.org

0, 0, 1, 0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 0, 1, 20, 11, 11, 11, 11, 11, 11, 11, 11, 11, 0, 1
Offset: 0

Views

Author

Rémy Sigrist, Jan 20 2018

Keywords

Comments

The corresponding sequence for the binary base is A295653.

Examples

			Square array begins:
  n\k|  0   1   2   3   4   5   6   7   8   9   10  ...
  ---+-------------------------------------------------
    0|  0   1   2   3   4   5   6   7   8   9   10  ... <-- A001477
    1|  0   1   2   3   4   5   6   7   8  10   11  ...
    2|  0   1   2   3   4   5   6   7  10  11   12  ...
    3|  0   1   2   3   4   5   6  10  11  12   13  ...
    4|  0   1   2   3   4   5  10  11  12  13   14  ...
    5|  0   1   2   3   4  10  11  12  13  14   20  ...
    6|  0   1   2   3  10  11  12  13  20  21   22  ...
    7|  0   1   2  10  11  12  20  21  22  30   31  ...
    8|  0   1  10  11  20  21  30  31  40  41   50  ...
    9|  0  10  20  30  40  50  60  70  80  90  100  ... <-- A008592
   10|  0   1   2   3   4   5   6   7   8   9   10  ...
		

Crossrefs

Programs

  • PARI
    T(n,k,{base=10}) = my (v=0, p=1); while (k, my (r=base - (n%base)); v += p*(k%r); n \= base; k \= r; p *= base); v

Formula

For any n >= 0 and k >= 0:
- T(0, k) = k,
- T(9, k) = 10 * k,
- T(10^n - 1, k) = 10^n * k,
- T(n, 0) = 0,
- T(n, 1) = 10^A122840(n+1),
- T(n, k + A298372(n)) = k + 10^A004218(n+1) (i.e. each row is linear).

A321999 Sum of digits of n minus the number of digits of n.

Original entry on oeis.org

0, 0, 1, 2, 3, 4, 5, 6, 7, 8, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7
Offset: 0

Views

Author

M. F. Hasler, Dec 07 2018

Keywords

Comments

Concerning 0 we use the convention that 0 has 0 digits, so a(0) = 0 - 0 = 0, a(1) = 1 - 1 = 0, and a(10) = 1 - 2 = -1 is the first negative terms of the sequence.

Examples

			a(0) = 0 - 0 = 0. (We consider 0 has 0 digits.)
a(1) = 1 - 1 = 0;
a(2) = 2 - 1 = 1, ...,
a(9) = 9 - 1 = 8. (General formula: a(10^k - 1) = 8*k.)
a(10) = 1 - 2 = -1. (General formula: a(10^k) = -k.)
a(11) = 1+1 - 2 = 0, ...,
a(19) = 1+9 - 2 = 8;
a(20) = 2+0 - 2 = 0. (General formula: a(m*10^k) = a(m) - k.)
a(29) = 2+9 - 2 = 9, ...,
a(99) = 9+9 - 2 = 16: cf. a(9);
a(100) = 1+0+0 - 3 = -2;
a(101) = 1+0+1 - 3 = -1;
a(102) = 1+0+2 - 3 = 0, ...,
a(109) = 1+0+9 - 3 = 7;
a(110) = 1+1+0 - 3 = -1, ...,
a(119) = 1+1+9 - 3 = 8, ...,
a(199) = 1+9+9 - 3 = 16,
a(200) = 2+0+0 - 3 = -1: cf. a(20), ...,
a(999) = 9+9+9 - 3 = 24: cf. a(9);
a(1000) = 1+0+0+0 - 4 = -3, ...,
a(1001) = 1+0+0+1 - 4 = -2, ....
		

Crossrefs

Cf. A007953 (digit sum of n), A004218 (ceiling(log_10(n))), A055642 (number of digits of n).
The zeroes of this sequence, except 0 itself, are in A061384.

Programs

  • Maple
    a:= n-> add(i, i=convert(n, base, 10))-length(n):
    seq(a(n), n=0..100);  # Alois P. Heinz, Dec 10 2018
  • Mathematica
    Table[(Plus@@IntegerDigits[n]) - Length[IntegerDigits[n]] + KroneckerDelta[n, 0], {n, 0, 99}] (* Alonso del Arte, Dec 07 2018 *)
    Table[Total[IntegerDigits[n]]-IntegerLength[n],{n,0,100}] (* Harvey P. Dale, Dec 27 2022 *)
  • PARI
    A321999(n)=sumdigits(n)-if(n,logint(n,10)+1)

Formula

a(n) = A007953(n) - A004218(n+1) = A007953(n) - A055642(n) for all n > 0. a(m*10^k) = a(m) - k for all m > 0, k >= 0, in particular:
a(10^k) = -k for all k >= 0. a(m) = m - 1 for 0 < m < 10.
a(n+1) = a(n) + 1 unless n = 9 (mod 10), in which case a(n+1) = a((n+1)/10).
a(10^k-1) = 8*k.
Showing 1-9 of 9 results.