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.

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

A047813 Largest palindromic substring of n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 11, 2, 3, 4, 5, 6, 7, 8, 9, 2, 2, 22, 3, 4, 5, 6, 7, 8, 9, 3, 3, 3, 33, 4, 5, 6, 7, 8, 9, 4, 4, 4, 4, 44, 5, 6, 7, 8, 9, 5, 5, 5, 5, 5, 55, 6, 7, 8, 9, 6, 6, 6, 6, 6, 6, 66, 7, 8, 9, 7, 7, 7, 7, 7, 7, 7, 77, 8, 9, 8, 8, 8, 8, 8, 8, 8, 8, 88, 9, 9, 9, 9, 9, 9, 9
Offset: 0

Views

Author

Keywords

Comments

a(n) = A262188(n,A262190(n)-1). - Reinhard Zumkeller, Sep 14 2015

Examples

			a(1313) = Max{1,3,131,313} = 313.
		

Crossrefs

Programs

  • Haskell
    a047813 = last . a262188_row
    -- Reinhard Zumkeller, Sep 14 2015, Aug 23 2011
    
  • Mathematica
    palQ[n_Integer, base_Integer] := Module[{idn = IntegerDigits[n, base]}, idn == Reverse[ idn]]; f[n_] := Block[{id = IntegerDigits@ n, mx = -Infinity}, k = Length@ id; While[k > 0 && mx == -Infinity, mx = Max[mx, Select[ FromDigits@# & /@ Partition[id, k, 1], palQ[#, 10] &]]; k--]; mx] (* Robert G. Wilson v, Aug 24 2011 *)
    lps[n_]:=Module[{idn=IntegerDigits[n]},Max[FromDigits/@Select[ Flatten[ Table[ Partition[ idn,i,1],{i,Length[idn]}],1],#==Reverse[#]&]]]; Array[ lps,100,0] (* Harvey P. Dale, Jan 09 2015 *)
  • Python
    def c(s): return (s[0] != "0" or s == "0") and s == s[::-1]
    def a(n):
        s = str(n)
        ss = (s[i:j] for i in range(len(s)) for j in range(i+1, len(s)+1))
        return max(int(w) for w in ss if c(w))
    print([a(n) for n in range(96)]) # Michael S. Branicky, Sep 18 2022

A262188 Table read by rows: row n contains all distinct palindromes contained as substrings in decimal representation of n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 1, 11, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 0, 2, 1, 2, 2, 22, 2, 3, 2, 4, 2, 5, 2, 6, 2, 7, 2, 8, 2, 9, 0, 3, 1, 3, 2, 3, 3, 33, 3, 4, 3, 5, 3, 6, 3, 7, 3, 8, 3, 9, 0, 4, 1, 4, 2, 4, 3, 4, 4, 44, 4, 5, 4, 6, 4
Offset: 0

Views

Author

Reinhard Zumkeller, Sep 14 2015

Keywords

Comments

Length of row n = A262190(n);
T(n,0) = A054054(n);
T(n,A262190(n)-1) = A047813(n).

Examples

			.     n |  T(n,*)           n |  T(n,*)              n |  T(n,*)
.  -----+-----------    ------+-------------    -------+--------------
.   100 |  0,1           1000 |  0,1             10000 |  0,1
.   101 |  0,1,101       1001 |  0,1,1001        10001 |  0,1,10001
.   102 |  0,1,2         1002 |  0,1,2           10002 |  0,1,2
.   103 |  0,1,3         1003 |  0,1,3           10003 |  0,1,3
.   104 |  0,1,4         1004 |  0,1,4           10004 |  0,1,4
.   105 |  0,1,5         1005 |  0,1,5           10005 |  0,1,5
.   106 |  0,1,6         1006 |  0,1,6           10006 |  0,1,6
.   107 |  0,1,7         1007 |  0,1,7           10007 |  0,1,7
.   108 |  0,1,8         1008 |  0,1,8           10008 |  0,1,8
.   109 |  0,1,9         1009 |  0,1,9           10009 |  0,1,9
.   110 |  0,1,11        1010 |  0,1,101         10010 |  0,1,1001
.   111 |  1,11,111      1011 |  0,1,11,101      10011 |  0,1,11,1001
.   112 |  1,2,11        1012 |  0,1,2,101       10012 |  0,1,2,1001
.   113 |  1,3,11        1013 |  0,1,3,101       10013 |  0,1,3,1001
.   114 |  1,4,11        1014 |  0,1,4,101       10014 |  0,1,4,1001
.   115 |  1,5,11        1015 |  0,1,5,101       10015 |  0,1,5,1001
.   116 |  1,6,11        1016 |  0,1,6,101       10016 |  0,1,6,1001
.   117 |  1,7,11        1017 |  0,1,7,101       10017 |  0,1,7,1001
.   118 |  1,8,11        1018 |  0,1,8,101       10018 |  0,1,8,1001
.   119 |  1,9,11        1019 |  0,1,9,101       10019 |  0,1,9,1001
.   120 |  0,1,2         1020 |  0,1,2           10020 |  0,1,2
.   121 |  1,2,121       1021 |  0,1,2           10021 |  0,1,2
.   122 |  1,2,22        1022 |  0,1,2,22        10022 |  0,1,2,22
.   123 |  1,2,3         1023 |  0,1,2,3         10023 |  0,1,2,3
.   124 |  1,2,4         1024 |  0,1,2,4         10024 |  0,1,2,4
.   125 |  1,2,5         1025 |  0,1,2,5         10025 |  0,1,2,5  .
		

Crossrefs

Cf. A262190 (row lengths), A054054 (left edge), A047813 (right edge), A136522, A002113.

Programs

  • Haskell
    import Data.List (inits, tails, nub, sort)
    a262188 n k = a262188_tabf !! n !! k
    a262188_row n = a262188_tabf !! n
    a262188_tabf = map (sort . nub . map (foldr (\d v -> 10 * v + d) 0) .
       filter (\xs -> length xs == 1 || last xs > 0 && reverse xs == xs) .
              concatMap (tail . inits) . tails) a031298_tabf
    
  • PARI
    A262188_row(n,b=10)=Set(concat(vector(logint(n+!n,b)+1,m,m=n\=b^(m>1);select(is_A002113,vector(logint(m+!m,b)+1,k,m%b^k))))) \\ M. F. Hasler, Jun 19 2018

A262198 Numbers such that the number of distinct palindromes contained as substring in their decimal representation differs from the length thereof.

Original entry on oeis.org

100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1020, 1021, 1030, 1031, 1040, 1041, 1050, 1051, 1060, 1061, 1070, 1071, 1080, 1081, 1090, 1091, 1100, 1200, 1201, 1231, 1241, 1251, 1261, 1271
Offset: 1

Views

Author

Reinhard Zumkeller, Sep 14 2015

Keywords

Comments

Or, numbers n such that A055642(n) != A262190(n).
a(22) = 1021 is the first term which differs from "numbers having at least two digits 0 in their decimal representation" (not in OEIS). It seems that A043490 is a subsequence. - M. F. Hasler, Jun 19 2018

Examples

			a(39) = 1201, containing just 3 trivial palindromes 0, 1 and 2;
1202, also of length = 4, contains exactly 4 palindromes 0, 1, 2 and 202, therefore 1202 is not a term.
		

Crossrefs

Programs

  • Haskell
    a262198 n = a262198_list !! (n-1)
    a262198_list = [x | x <- [0..], a055642 x /= a262190 x]
    
  • PARI
    is(n)=#digits(n)!=A262190(n) \\ M. F. Hasler, Jun 19 2018

Extensions

Definition clarified by M. F. Hasler, Jun 19 2018
Showing 1-4 of 4 results.