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-10 of 13 results. Next

A004488 Tersum n + n.

Original entry on oeis.org

0, 2, 1, 6, 8, 7, 3, 5, 4, 18, 20, 19, 24, 26, 25, 21, 23, 22, 9, 11, 10, 15, 17, 16, 12, 14, 13, 54, 56, 55, 60, 62, 61, 57, 59, 58, 72, 74, 73, 78, 80, 79, 75, 77, 76, 63, 65, 64, 69, 71, 70, 66, 68, 67, 27, 29, 28, 33, 35, 34, 30, 32, 31, 45, 47, 46, 51
Offset: 0

Views

Author

Keywords

Comments

Could also be described as "Write n in base 3, then replace each digit with its base-3 negative" as with A048647 for base 4. - Henry Bottomley, Apr 19 2000
a(a(n)) = n, a self-inverse permutation of the nonnegative integers. - Reinhard Zumkeller, Dec 19 2003
First 3^n terms of the sequence form a permutation s(n) of 0..3^n-1, n>=1; the number of inversions of s(n) is A016142(n-1). - Gheorghe Coserea, Apr 23 2018

Crossrefs

Programs

  • Haskell
    a004488 0 = 0
    a004488 n = if d == 0 then 3 * a004488 n' else 3 * a004488 n' + 3 - d
                where (n', d) = divMod n 3
    -- Reinhard Zumkeller, Mar 12 2014
    
  • Maple
    a:= proc(n) local t, r, i;
          t, r:= n, 0;
          for i from 0 while t>0 do
            r:= r+3^i *irem(2*irem(t, 3, 't'), 3)
          od; r
        end:
    seq(a(n), n=0..80);  # Alois P. Heinz, Sep 07 2011
  • Mathematica
    a[n_] := FromDigits[Mod[3-IntegerDigits[n, 3], 3], 3]; Table[a[n], {n, 0, 66}] (* Jean-François Alcover, Mar 03 2014 *)
  • PARI
    a(n) = my(b=3); fromdigits(apply(d->(b-d)%b, digits(n, b)), b);
    vector(67, i, a(i-1))  \\ Gheorghe Coserea, Apr 23 2018
    
  • Python
    from sympy.ntheory.factor_ import digits
    def a(n): return int("".join([str((3 - i)%3) for i in digits(n, 3)[1:]]), 3) # Indranil Ghosh, Jun 06 2017

Formula

Tersum m + n: write m and n in base 3 and add mod 3 with no carries, e.g., 5 + 8 = "21" + "22" = "10" = 1.
a(n) = Sum(3-d(i)-3*0^d(i): n=Sum(d(i)*3^d(i): 0<=d(i)<3)). - Reinhard Zumkeller, Dec 19 2003
a(3*n) = 3*a(n), a(3*n+1) = 3*a(n)+2, a(3*n+2) = 3*a(n)+1. - Robert Israel, May 09 2014

A055120 Digital complement of n (replace each nonzero digit d with 10-d).

Original entry on oeis.org

0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 90, 99, 98, 97, 96, 95, 94, 93, 92, 91, 80, 89, 88, 87, 86, 85, 84, 83, 82, 81, 70, 79, 78, 77, 76, 75, 74, 73, 72, 71, 60, 69, 68, 67, 66, 65, 64, 63, 62, 61, 50, 59, 58, 57, 56, 55, 54, 53, 52, 51, 40, 49, 48, 47, 46, 45, 44, 43, 42, 41, 30, 39
Offset: 0

Views

Author

Henry Bottomley, Apr 19 2000

Keywords

Comments

a(n) = -n in carryless arithmetic mod 10 - that is, n + a(n) = 0 (cf. A169894). - N. J. A. Sloane, Aug 03 2010

Examples

			a(11) = 99 because 1 + 9 = 0 mod 10 for each digit.
a(20) = 80 because 2 + 8 = 0 mod 10 and 0 + 0 = 0 mod 10.
		

Crossrefs

Column k=10 of A248813.

Programs

  • Haskell
    a055120 = foldl f 0 . reverse . unfoldr g where
       f v d = if d == 0 then 10 * v else 10 * v + 10 - d
       g x = if x == 0 then Nothing else Just $ swap $ divMod x 10
    -- Reinhard Zumkeller, Oct 04 2011
    
  • Maple
    f:=proc(n) local t0,t1,i;
    t0:=0; t1:=convert(n,base,10);
    for i from 1 to nops(t1) do
    if t1[i]>0 then t0:=t0+(10-t1[i])*10^(i-1); fi;
    od:
    RETURN(t0);
    end;
    # N. J. A. Sloane, Jan 21 2011
  • Mathematica
    a[n_] := FromDigits[ IntegerDigits[n] /. d_?Positive -> 10-d]; Table[a[n], {n, 0, 100}](* Jean-François Alcover, Nov 28 2011 *)
  • PARI
    a(n)=fromdigits(apply(d->if(d,10-d,0),digits(n))) \\ Charles R Greathouse IV, Feb 08 2017
    
  • Python
    def A055120(n): return int(''.join(str(10-int(d)) if d != '0' else d for d in str(n))) # Chai Wah Wu, Apr 03 2021

Formula

From Robert Israel, Sep 04 2017: (Start)
a(10*n) = 10*a(n).
a(10*n+j) = 10*a(n) + 10 - j for 1 <= j <= 9.
G.f. g(x) satisfies g(x) = 10*(1+x+x^2+...+x^9)*g(x^10) + (9*x+8*x^2+7*x^3+6*x^4+5*x^5+4*x^6+3*x^7+2*x^8+x^9)/(1-x^10).
(End)

A248813 A(n,k) is the base-k complement of n; square array A(n,k), n>=0, k>=2, read by antidiagonals.

Original entry on oeis.org

0, 0, 1, 0, 2, 2, 0, 3, 1, 3, 0, 4, 2, 6, 4, 0, 5, 3, 1, 8, 5, 0, 6, 4, 2, 12, 7, 6, 0, 7, 5, 3, 1, 15, 3, 7, 0, 8, 6, 4, 2, 20, 14, 5, 8, 0, 9, 7, 5, 3, 1, 24, 13, 4, 9, 0, 10, 8, 6, 4, 2, 30, 23, 8, 18, 10, 0, 11, 9, 7, 5, 3, 1, 35, 22, 11, 20, 11, 0, 12, 10, 8, 6, 4, 2, 42, 34, 21, 10, 19, 12
Offset: 0

Views

Author

Alois P. Heinz, Mar 03 2015

Keywords

Comments

Every column is a permutation of the nonnegative integers.

Examples

			Square array A(n,k) begins:
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, ...
   1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, ...
   2,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, ...
   3,  6,  1,  2,  3,  4,  5,  6,  7,  8,  9, ...
   4,  8, 12,  1,  2,  3,  4,  5,  6,  7,  8, ...
   5,  7, 15, 20,  1,  2,  3,  4,  5,  6,  7, ...
   6,  3, 14, 24, 30,  1,  2,  3,  4,  5,  6, ...
   7,  5, 13, 23, 35, 42,  1,  2,  3,  4,  5, ...
   8,  4,  8, 22, 34, 48, 56,  1,  2,  3,  4, ...
   9, 18, 11, 21, 33, 47, 63, 72,  1,  2,  3, ...
  10, 20, 10, 15, 32, 46, 62, 80, 90,  1,  2, ...
		

Crossrefs

Programs

  • Maple
    A:= proc(n, k) local t, r, i; t, r:= n, 0;
          for i from 0 while t>0 do
            r:= r+k^i *irem(k-irem(t, k, 't'), k)
          od; r
        end:
    seq(seq(A(n, 2+d-n), n=0..d), d=0..14);
  • PARI
    A(n,k)=fromdigits(apply(d->(k-d)%k, digits(n, k)), k); \\ Gheorghe Coserea, Apr 23 2018

A055126 Base-16 complement of n (write n in base 16, then replace each digit with its base-16 negative).

Original entry on oeis.org

0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 240, 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 224, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 208, 223, 222, 221, 220, 219, 218, 217, 216, 215
Offset: 0

Views

Author

Henry Bottomley, Apr 19 2000

Keywords

Crossrefs

Column k=16 of A248813.

Programs

  • Haskell
    a055126 0 = 0
    a055126 n = if d == 0 then 16 * a055126 n' else 16 * a055126 n' + 16 - d
                where (n', d) = divMod n 16
    -- Reinhard Zumkeller, Mar 12 2014

A055116 Base-6 complement of n (write n in base 6, then replace each digit with its base-6 negative).

Original entry on oeis.org

0, 5, 4, 3, 2, 1, 30, 35, 34, 33, 32, 31, 24, 29, 28, 27, 26, 25, 18, 23, 22, 21, 20, 19, 12, 17, 16, 15, 14, 13, 6, 11, 10, 9, 8, 7, 180, 185, 184, 183, 182, 181, 210, 215, 214, 213, 212, 211, 204, 209, 208, 207, 206, 205, 198, 203, 202, 201, 200, 199, 192, 197, 196
Offset: 0

Views

Author

Henry Bottomley, Apr 19 2000

Keywords

Crossrefs

Column k=6 of A248813.

A055117 Base-7 complement of n (write n in base 7, then replace each digit with its base-7 negative).

Original entry on oeis.org

0, 6, 5, 4, 3, 2, 1, 42, 48, 47, 46, 45, 44, 43, 35, 41, 40, 39, 38, 37, 36, 28, 34, 33, 32, 31, 30, 29, 21, 27, 26, 25, 24, 23, 22, 14, 20, 19, 18, 17, 16, 15, 7, 13, 12, 11, 10, 9, 8, 294, 300, 299, 298, 297, 296, 295, 336, 342, 341, 340, 339, 338, 337, 329, 335, 334
Offset: 0

Views

Author

Henry Bottomley, Apr 19 2000

Keywords

Crossrefs

Column k=7 of A248813.

A055118 Base-8 complement of n (write n in base 8, then replace each digit with its base-8 negative).

Original entry on oeis.org

0, 7, 6, 5, 4, 3, 2, 1, 56, 63, 62, 61, 60, 59, 58, 57, 48, 55, 54, 53, 52, 51, 50, 49, 40, 47, 46, 45, 44, 43, 42, 41, 32, 39, 38, 37, 36, 35, 34, 33, 24, 31, 30, 29, 28, 27, 26, 25, 16, 23, 22, 21, 20, 19, 18, 17, 8, 15, 14, 13, 12, 11, 10, 9, 448, 455, 454, 453, 452, 451
Offset: 0

Views

Author

Henry Bottomley, Apr 19 2000

Keywords

Crossrefs

Column k=8 of A248813.

Programs

  • Haskell
    a055118 0 = 0
    a055118 n = if d == 0 then 8 * a055118 n' else 8 * a055118 n' + 8 - d
                where (n', d) = divMod n 8
    -- Reinhard Zumkeller, Mar 12 2014

A055119 Base-9 complement of n (write n in base 9, then replace each digit with its base-9 negative).

Original entry on oeis.org

0, 8, 7, 6, 5, 4, 3, 2, 1, 72, 80, 79, 78, 77, 76, 75, 74, 73, 63, 71, 70, 69, 68, 67, 66, 65, 64, 54, 62, 61, 60, 59, 58, 57, 56, 55, 45, 53, 52, 51, 50, 49, 48, 47, 46, 36, 44, 43, 42, 41, 40, 39, 38, 37, 27, 35, 34, 33, 32, 31, 30, 29, 28, 18, 26, 25, 24, 23, 22, 21, 20, 19
Offset: 0

Views

Author

Henry Bottomley, Apr 19 2000

Keywords

Crossrefs

Column k=9 of A248813.

A055121 Base-11 complement of n (write n in base 11, then replace each digit with its base-11 negative).

Original entry on oeis.org

0, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 110, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 99, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 88, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 77, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 66, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67
Offset: 0

Views

Author

Henry Bottomley, Apr 19 2000

Keywords

Crossrefs

Column k=11 of A248813.

A055122 Base-12 complement of n (write n in base 12, then replace each digit with its base-12 negative).

Original entry on oeis.org

0, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 132, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 120, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 108, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 96, 107, 106, 105, 104, 103, 102, 101, 100, 99
Offset: 0

Views

Author

Henry Bottomley, Apr 19 2000

Keywords

Crossrefs

Column k=12 of A248813.

Programs

  • Haskell
    a055122 0 = 0
    a055122 n = if d == 0 then 12 * a055122 n' else 12 * a055122 n' + 12 - d
                where (n', d) = divMod n 12
    -- Reinhard Zumkeller, Mar 12 2014
Showing 1-10 of 13 results. Next