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 21-30 of 40 results. Next

A031007 Triangle T(n,k): Write n in base 7, reverse order of digits, to get row n.

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Cf. A030308, A030341, A030386, A031235, A030567, A031045, A031087, A031298 for the base-2 to base-10 analogs.

Programs

  • Mathematica
    Flatten[Table[Reverse[IntegerDigits[n,7]],{n,0,50}]] (* Harvey P. Dale, Feb 25 2014 *)
  • PARI
    A031007(n, k=-1)={k<0&&error("Flattened sequence not yet implemented.");n\7^k%7} \\ Assuming that columns start with k=0 as in A030308, A030341, ... TO DO: implement flattened sequence, such that A030567(n)=a(n). - M. F. Hasler, Jul 21 2013

Extensions

Initial 0 and better name by Philippe Deléham, Oct 20 2011

A064834 If n (in base 10) is d_1 d_2 ... d_k then a(n) = Sum_{i = 1..[k/2] } |d_i - d_{k-i+1}|.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Oct 25 2001

Keywords

Comments

Might be called the Palindromic Deviation (or PD(n)) of n, since it measures how far n is from being a palindrome. - W. W. Kokko, Mar 13 2013
a(A002113(n)) = 0; a(A029742(n)) > 0; A136522(n) = A000007(a(n)). - Reinhard Zumkeller, Sep 18 2013

Examples

			a(456) = | 4 - 6 | = 2, a(4567) = | 4 - 7 | + | 5 - 6 | = 4.
		

Crossrefs

Programs

  • Haskell
    a064834 n = sum $ take (length nds `div` 2) $
                      map abs $ zipWith (-) nds $ reverse nds
       where nds = a031298_row n
    -- Reinhard Zumkeller, Sep 18 2013
    
  • Maple
    f:=proc(n)
    local t1,t2,i;
    t1:=convert(n,base,10);
    t2:=nops(t1);
    add( abs(t1[i]-t1[t2+1-i]),i=1..floor(t2/2) );
    end;
    [seq(f(n),n=0..120)]; # N. J. A. Sloane, Mar 24 2013
  • Mathematica
    f[n_] := (k = IntegerDigits[n]; l = Length[k]; Sum[ Abs[ k[[i]] - k[[l - i + 1]]], {i, 1, Floor[l/2] } ] ); Table[ f[n], {n, 0, 100} ]
  • Python
    from sympy import floor, ceiling
    def A064834(n):
        x, y = str(n), 0
        lx2 = len(x)/2
        for a,b in zip(x[:floor(lx2)],x[:ceiling(lx2)-1:-1]):
            y += abs(int(a)-int(b))
        return y
    # Chai Wah Wu, Aug 09 2014

Extensions

More terms from Vladeta Jovovic, Matthew Conroy and Robert G. Wilson v, Oct 26 2001

A076489 Number of common (distinct) digits of consecutive natural numbers.

Original entry on oeis.org

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

Views

Author

Labos Elemer, Oct 21 2002

Keywords

Comments

a(A226637(n)) = 0. Reinhard Zumkeller, Sep 01 2013
This is the prefix overlap between the decimal expansions of n and n+1 (cf. A238845). - N. J. A. Sloane, Mar 22 2014

Crossrefs

Cf. A001477, A031298, A076490, A238845, A239092 (partial sums).

Programs

  • Haskell
    import Data.List (intersect, nub)
    a076489 n = a076489_list !! n
    a076489_list = map (length . nub) $
                   zipWith intersect (tail a031298_tabf) a031298_tabf
    -- Reinhard Zumkeller, Sep 01 2013
  • Mathematica
    Table[Length[Intersection[IntegerDigits[w], IntegerDigits[w+1]]], {w, 0, 200}]

Extensions

Initial zero prepended and offset adjusted by Reinhard Zumkeller, Sep 01 2013

A068505 Decimal representation of n interpreted in base b+1, where b=A054055(n) is the largest digit in decimal representation of n.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 5, 7, 9, 11, 13, 15, 17, 19, 6, 7, 8, 11, 14, 17, 20, 23, 26, 29, 12, 13, 14, 15, 19, 23, 27, 31, 35, 39, 20, 21, 22, 23, 24, 29, 34, 39, 44, 49, 30, 31, 32, 33, 34, 35, 41, 47, 53, 59, 42, 43, 44, 45, 46, 47, 48, 55, 62, 69, 56, 57, 58, 59, 60, 61
Offset: 1

Views

Author

Reinhard Zumkeller, Mar 11 2002, Feb 23 2008

Keywords

Comments

a(n) = n iff n < 10 OR n is a "9ish number": a(A011539(n)) = A011539(n). - Reinhard Zumkeller, Dec 29 2011

Examples

			a(20)=2*3^1+0*1=6, a(21)=2*3^1+1*1=7, a(22)=2*3^1+2*1=8,
a(23)=2*4^1+3*1=11, a(24)=2*5^1+4*1=14, a(25)=2*6^1+5*1=17,
a(26)=2*7^1+6*1=20, a(27)=2*8^1+7*1=23, a(28)=2*9^1+8*1=26,
a(29)=2*10^1+9*1=29, a(30)=3*4^1+0*1=12, a(31)=3*4^1+1*1=13.
		

Crossrefs

Cf. A031298.

Programs

  • Haskell
    a068505 n = foldr (\d v -> v * b + d) 0 dds where
    b = maximum dds + 1
    dds = a031298_row n
    -- Reinhard Zumkeller, Feb 17 2013, Dec 29 2011
    
  • Maple
    f:= proc(n) local b,L,i;
    L:= convert(n,base,10);
    b:= max(L);
    add(L[i]*(b+1)^(i-1),i=1..nops(L));
    end proc:
    map(f, [$1..100]); # Robert Israel, Feb 02 2016
  • Mathematica
    a[n_] := (id = IntegerDigits[n] // Reverse; b = Max[id]+1; id.b^Range[0, Length[id]-1]); Table[a[n], {n, 1, 75}] (* Jean-François Alcover, May 15 2013 *)
    Table[FromDigits[IntegerDigits[n],Max[IntegerDigits[n]+1]],{n,80}] (* Harvey P. Dale, Dec 02 2015 *)
  • PARI
    a(n)=my(d = digits(n), b = vecmax(d)); subst(Pol(d), x, b+1); \\ Michel Marcus, Feb 12 2016

Extensions

Definition clarified and comment corrected by Martin Büttner, Feb 02 2016

A133048 Powerback(n): reverse the decimal expansion of n, drop any leading zeros, then apply the powertrain map of A133500 to the resulting number.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 2, 1, 4, 9, 16, 25, 36, 49, 64, 81, 3, 1, 8, 27, 64, 125, 216, 343, 512, 729, 4, 1, 16, 81, 256, 625, 1296, 2401, 4096, 6561, 5, 1, 32, 243, 1024, 3125, 7776, 16807, 32768, 59049, 6, 1, 64, 729, 4096, 15625, 46656, 117649
Offset: 0

Views

Author

J. H. Conway and N. J. A. Sloane, Dec 31 2007

Keywords

Comments

a(A221221(n)) = A133500(A221221(n)) = A222493(n). - Reinhard Zumkeller, May 27 2013

Examples

			E.g. 240 -> (0)42 -> 4^2 = 16; 12345 -> 54321 -> 5^4*3^2*1 = 5625.
		

Crossrefs

Cf. A131571 (fixed points), A133059 and A133134 (records); A133500 (powertrain).
Cf. A133144 (length of trajectory), A031346 and A003001 (persistence).
Cf. A031298.

Programs

  • Haskell
    a133048 0 = 0
    a133048 n = train $ dropWhile (== 0) $ a031298_row n where
       train []       = 1
       train [x]      = x
       train (u:v:ws) = u ^ v * (train ws)
    -- Reinhard Zumkeller, May 27 2013
  • Maple
    powerback:=proc(n) local a,i,j,t1,t2,t3;
    if n = 0 then RETURN(0); fi;
    t1:=convert(n, base, 10); t2:=nops(t1);
    for i from 1 to t2 do if t1[i] > 0 then break; fi; od:
    a:=1; t3:=t2-i+1;
    for j from 0 to floor(t3/2)-1 do a := a*t1[i+2*j]^t1[i+2*j+1]; od:
    if t3 mod 2 = 1 then a:=a*t1[t2]; fi;
    RETURN(a); end;
  • Mathematica
    ptm[n_]:=Module[{idn=IntegerDigits[IntegerReverse[n]]},If[ EvenQ[ Length[idn]],Times@@ (#[[1]]^#[[2]]&/@Partition[idn,2]),(Times@@(#[[1]]^#[[2]]&/@Partition[ Most[ idn],2]))Last[idn]]];Array[ptm,70,0] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jul 05 2020 *)

A218978 Table read by rows: n-th row lists all distinct substrings of decimal representation of n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 10, 1, 11, 1, 2, 12, 1, 3, 13, 1, 4, 14, 1, 5, 15, 1, 6, 16, 1, 7, 17, 1, 8, 18, 1, 9, 19, 0, 2, 20, 1, 2, 21, 2, 22, 2, 3, 23, 2, 4, 24, 2, 5, 25, 2, 6, 26, 2, 7, 27, 2, 8, 28, 2, 9, 29, 0, 3, 30, 1, 3, 31, 2, 3, 32, 3
Offset: 0

Views

Author

Reinhard Zumkeller, May 02 2015, Nov 10 2012

Keywords

Comments

A120004(n) = length of n-th row;
A154771(n) = sum of n-th row.

Examples

			Rows 100 .. 112:
.  100:  {0, 1, 10, 100},
.  101:  {0, 1, 10, 101},
.  102:  {0, 1, 2, 10, 102},
.  103:  {0, 1, 3, 10, 103},
.  104:  {0, 1, 4, 10, 104},
.  105:  {0, 1, 5, 10, 105},
.  106:  {0, 1, 6, 10, 106},
.  107:  {0, 1, 7, 10, 107},
.  108:  {0, 1, 8, 10, 108},
.  109:  {0, 1, 9, 10, 109},
.  110:  {0, 1, 10 ,11, 110},
.  111:  {1, 11, 111},
.  112:  {1, 2, 11, 12, 112}.
		

Crossrefs

Cf. A031298, A219031 (squares in row), A262188 (palindromes in row).

Programs

  • Haskell
    import Data.List (inits, tails, sort, nub, genericIndex)
    a218978 n k = a218978_row n !! k
    a218978_row n = genericIndex a218978_tabf n
    a218978_tabf = map (sort . nub . map (foldr (\d v -> 10 * v + d) 0) .
                       concatMap (tail . inits) . tails) a031298_tabf
    -- Reinhard Zumkeller, corrected: Sep 15 2015, May 02 2015, Nov 10 2012

A167831 Largest m<=n such that no carry occurs when adding m to n in decimal arithmetic.

Original entry on oeis.org

0, 1, 2, 3, 4, 4, 3, 2, 1, 0, 10, 11, 12, 13, 14, 14, 13, 12, 11, 10, 20, 21, 22, 23, 24, 24, 23, 22, 21, 20, 30, 31, 32, 33, 34, 34, 33, 32, 31, 30, 40, 41, 42, 43, 44, 44, 43, 42, 41, 40, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27
Offset: 0

Views

Author

Reinhard Zumkeller, Nov 14 2009

Keywords

Comments

A167832(n) = a(n) + n.

Crossrefs

Cf. A167877, A035327 for the ternary and binary cases.
Cf. A031298.

Programs

  • Haskell
    a167831 n = head [x | let ds = a031298_row n, x <- [n, n-1 ..],
                          all (< 10) $ zipWith (+) ds (a031298_row x)]
    -- Reinhard Zumkeller, Mar 15 2014

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

A119246 Numbers containing in decimal representation their digital root.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 19, 20, 29, 30, 39, 40, 49, 50, 59, 60, 69, 70, 79, 80, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 109, 118, 127, 128, 136, 138, 145, 148, 154, 158, 163, 168, 172, 178, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 198, 199, 200
Offset: 1

Views

Author

Reinhard Zumkeller, May 10 2006

Keywords

Comments

Complement of A119247.
For terms u: all digital permutations of u form terms; u*10 and all insertions of 0 are terms; if v is another term, then the concatenations uv, vu are also terms, as well as all insertions of v in u; these properties allow the construction of all terms beginning with {d:1<=d<=9}. - Reinhard Zumkeller, May 19 2006

Crossrefs

Programs

  • Haskell
    a119246 n = a119246_list !! (n-1)
    a119246_list =
        filter (\x -> a010888 x `elem` a031298_row (fromInteger x)) [0..]
    -- Reinhard Zumkeller, Dec 16 2013, Apr 14 2011
  • Mathematica
    d[n_] := IntegerDigits[n]; Select[Range[0, 200], MemberQ[d[#1], NestWhile[Total[d[#]] &, #1, # > 9 &]] &] (* Jayanta Basu, Jul 13 2013 *)

A227876 Write the decimal digits of n and take successive absolute differences; sequence is the sum of all digits at each level of the pyramid.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 2, 2, 4, 6, 8, 10, 12, 14, 16, 18, 4, 4, 4, 6, 8, 10, 12, 14, 16, 18, 6, 6, 6, 6, 8, 10, 12, 14, 16, 18, 8, 8, 8, 8, 8, 10, 12, 14, 16, 18, 10, 10, 10, 10, 10, 10, 12, 14, 16, 18, 12, 12, 12, 12, 12, 12, 12, 14, 16, 18, 14, 14, 14, 14, 14, 14, 14, 14, 16, 18, 16, 16, 16, 16, 16, 16, 16, 16, 16, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 3, 4, 7, 10, 13, 16, 19, 22, 25, 28, 4, 3, 6, 9, 12, 15, 18, 21, 24, 27, 7, 6, 7, 8, 11, 14, 17, 20, 23, 26
Offset: 0

Views

Author

Filipi R. de Oliveira, Oct 25 2013

Keywords

Comments

A given nonnegative integer n is decomposed into its digits and the absolute differences between the digits are taken, then the differences between differences between digits (and so on, until the top of the difference pyramid is reached). The sum of the resulting digits is a(n).

Examples

			a(364)=19
.
____1____
__3_:_2_ --> 3+6+4+|3-6|+|6-4|+||3-6|-|6-4||=3+6+4+3+2+1=19
3_:_6_:_4
		

Crossrefs

Cf. A031298.

Programs

  • Haskell
    a227876 n = fst $ until (null . snd) h (0, a031298_row n) where
                h (s, ds) = (s + sum ds, map abs $ zipWith (-) ds $ tail ds)
    -- Reinhard Zumkeller, Apr 28 2014
  • Mathematica
    Join[{0},Table[Total[Abs[Flatten[NestList[Differences[Abs[#]]&, IntegerDigits[n], IntegerLength[n]-1]]]],{n,130}]] (* Harvey P. Dale, Mar 02 2015 *)
  • PARI
    a(n)=my(d=digits(n),s); while(#d, s+=sum(i=1,#d,d[i]); d=vector(#d-1,i,abs(d[i+1]-d[i]))); s \\ Charles R Greathouse IV, Oct 25 2013
    

Formula

a(n)=n, if 0<=n<=9;
a(n)=n-9*floor(n/10)+|-n+11*floor(n/10)|, if 10<=n<=99;
a(n)=n-9*floor(n/10)-9*floor(n/100)+|-floor(n/10)+11*floor(n/100)|+|-n+11*floor(n/10)-10*floor(n/100)|+||-floor(n/10)+11*floor(n/100)|-|-n+11*floor(n/10)-10*floor(n/100)||, if 100<=n<=999.
Previous Showing 21-30 of 40 results. Next