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 60 results. Next

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

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

Original entry on oeis.org

0, 4, 3, 2, 1, 20, 24, 23, 22, 21, 15, 19, 18, 17, 16, 10, 14, 13, 12, 11, 5, 9, 8, 7, 6, 100, 104, 103, 102, 101, 120, 124, 123, 122, 121, 115, 119, 118, 117, 116, 110, 114, 113, 112, 111, 105, 109, 108, 107, 106, 75, 79, 78, 77, 76, 95, 99, 98, 97, 96, 90, 94, 93, 92
Offset: 0

Views

Author

Henry Bottomley, Apr 19 2000

Keywords

Crossrefs

Column k=5 of A248813.

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

A325820 Multiplication table for carryless product i X j in base 3 for i >= 0 and j >= 0, read by antidiagonals.

Original entry on oeis.org

0, 0, 0, 0, 1, 0, 0, 2, 2, 0, 0, 3, 1, 3, 0, 0, 4, 6, 6, 4, 0, 0, 5, 8, 9, 8, 5, 0, 0, 6, 7, 12, 12, 7, 6, 0, 0, 7, 3, 15, 16, 15, 3, 7, 0, 0, 8, 5, 18, 11, 11, 18, 5, 8, 0, 0, 9, 4, 21, 24, 13, 24, 21, 4, 9, 0, 0, 10, 18, 24, 19, 21, 21, 19, 24, 18, 10, 0, 0, 11, 20, 27, 23, 26, 9, 26, 23, 27, 20, 11, 0, 0, 12, 19, 30, 36, 19, 15, 15, 19, 36, 30, 19, 12, 0
Offset: 0

Views

Author

Antti Karttunen, May 22 2019

Keywords

Examples

			The array begins as:
  0,  0,  0,  0,  0,  0,  0,  0,  0,   0,   0,   0,   0, ...
  0,  1,  2,  3,  4,  5,  6,  7,  8,   9,  10,  11,  12, ...
  0,  2,  1,  6,  8,  7,  3,  5,  4,  18,  20,  19,  24, ...
  0,  3,  6,  9, 12, 15, 18, 21, 24,  27,  30,  33,  36, ...
  0,  4,  8, 12, 16, 11, 24, 19, 23,  36,  40,  44,  48, ...
  0,  5,  7, 15, 11, 13, 21, 26, 19,  45,  50,  52,  33, ...
  0,  6,  3, 18, 24, 21,  9, 15, 12,  54,  60,  57,  72, ...
  0,  7,  5, 21, 19, 26, 15, 13, 11,  63,  70,  68,  57, ...
  0,  8,  4, 24, 23, 19, 12, 11, 16,  72,  80,  76,  69, ...
  0,  9, 18, 27, 36, 45, 54, 63, 72,  81,  90,  99, 108, ...
  0, 10, 20, 30, 40, 50, 60, 70, 80,  90, 100,  83, 120, ...
  0, 11, 19, 33, 44, 52, 57, 68, 76,  99,  83,  91, 132, ...
  0, 12, 24, 36, 48, 33, 72, 57, 69, 108, 120, 132, 144, ...
  etc.
A(2,2) = 2*2 mod 3 = 1.
		

Crossrefs

Cf. A169999 (the main diagonal).
Row/Column 0: A000004, Row/Column 1: A001477, Row/Column 2: A004488, Row/Column 3: A008585, Row/Column 4: A242399, Row/Column 9: A008591.
Cf. A325821 (same table without the zero row and column).
Cf. A048720 (binary), A059692 (decimal), A004247 (full multiply).

Programs

  • PARI
    up_to = 105;
    A325820sq(b, c) = fromdigits(Vec(Pol(digits(b,3))*Pol(digits(c,3)))%3, 3);
    A325820list(up_to) = { my(v = vector(up_to), i=0); for(a=0,oo, for(col=0,a, if(i++ > up_to, return(v)); v[i] = A325820sq(a-col,col))); (v); };
    v325820 = A325820list(up_to);
    A325820(n) = v325820[1+n];

A004489 Table of tersums m + n (answers written in base 10).

Original entry on oeis.org

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

Views

Author

Keywords

Examples

			Table begins:
  0 1 2 3 4 5 6 ...
  1 2 0 4 5 3 7 ...
  2 0 1 5 3 4 8 ...
  3 4 5 6 7 8 0 ...
  4 5 3 7 8 6 1 ...
  5 3 4 8 6 7 2 ...
  6 7 8 0 1 2 3 ...
  ...
		

Crossrefs

Similar to but different from A004481.
Main diagonal gives A004488.
Cf. A003987 (analogous sequence for base 2).

Programs

  • Maple
    T:= proc(n, m) local t, h, r, i;
          t, h, r:= n, m, 0;
          for i from 0 while t>0 or h>0 do
            r:= r +3^i *irem(irem(t, 3, 't') +irem(h, 3, 'h'), 3)
          od; r
        end:
    seq(seq(T(n, d-n), n=0..d), d=0..12);  # Alois P. Heinz, Sep 07 2011
  • Mathematica
    T[n_, m_] := Module[{t, h, r, i, remt, remh}, {t, h, r} = {n, m, 0}; For[i = 0, t>0 || h>0, i++, r = r + 3^i*Mod[({t, remt} = QuotientRemainder[t, 3 ]; remt) + ({h, remh} = QuotientRemainder[h, 3]; remh), 3]]; r]; Table[Table[T[n, d-n], {n, 0, d}], {d, 0, 13}] // Flatten (* Jean-François Alcover, Jan 07 2014, translated from Maple *)
  • PARI
    T(n,m) = fromdigits(Vec(Pol(digits(n,3)) + Pol(digits(m,3)))%3, 3); \\ Kevin Ryde, Apr 06 2021
    
  • Python
    def T(n, m):
      k, pow3 = 0, 1
      while n + m > 0:
        n, rn = divmod(n, 3)
        m, rm = divmod(m, 3)
        k, pow3 = k + pow3*((rn+rm)%3), pow3*3
      return k
    print([T(n, d-n) for d in range(14) for n in range(d+1)]) # Michael S. Branicky, May 04 2021

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.

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Jan 23 2001

A289831 a(n) = A289813(n) + A289814(n).

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Jul 13 2017

Keywords

Comments

The ones in the binary representation of a(n) correspond to the nonzero digits in the ternary representation of n; for example: ternary(42) = 1120 and binary(a(42)) = 1110 (a(42) = 14).
Each number k >= 0 appears 2^A000120(k) times.
a(A004488(n)) = a(n).

Examples

			The first values, alongside the ternary representation of n, and the binary representation of a(n), are:
n       a(n)    ternary(n)  binary(a(n))
--      ----    ----------  ------------
0       0       0           0
1       1       1           1
2       1       2           1
3       2       10          10
4       3       11          11
5       3       12          11
6       2       20          10
7       3       21          11
8       3       22          11
9       4       100         100
10      5       101         101
11      5       102         101
12      6       110         110
13      7       111         111
14      7       112         111
15      6       120         110
16      7       121         111
17      7       122         111
18      4       200         100
19      5       201         101
20      5       202         101
21      6       210         110
22      7       211         111
23      7       212         111
24      6       220         110
25      7       221         111
26      7       222         111
		

Crossrefs

Programs

  • Mathematica
    Table[FromDigits[Sign@ IntegerDigits[n, 3], 2], {n, 0, 100}] (* Indranil Ghosh, Aug 03 2017 *)
  • PARI
    a(n) = my (d=digits(n,3)); fromdigits(vector(#d, i, sign(d[i])), 2)
    
  • Python
    from sympy.ntheory.factor_ import digits
    from sympy import sign
    def a(n):
        d=digits(n, 3)[1:]
        return int(''.join(str(sign(i)) for i in d), 2)
    print([a(n) for n in range(101)]) # Indranil Ghosh, Aug 03 2017

Formula

a(0) = 0.
a(3*n) = 2*a(n).
a(3*n + 1) = 2*a(n) + 1.
a(3*n + 2) = 2*a(n) + 1.

A244042 In ternary representation of n, replace 2's with 0's.

Original entry on oeis.org

0, 1, 0, 3, 4, 3, 0, 1, 0, 9, 10, 9, 12, 13, 12, 9, 10, 9, 0, 1, 0, 3, 4, 3, 0, 1, 0, 27, 28, 27, 30, 31, 30, 27, 28, 27, 36, 37, 36, 39, 40, 39, 36, 37, 36, 27, 28, 27, 30, 31, 30, 27, 28, 27, 0, 1, 0, 3, 4, 3, 0, 1, 0, 9, 10, 9, 12, 13, 12, 9, 10, 9
Offset: 0

Views

Author

Joonas Pohjonen, Jun 17 2014

Keywords

Examples

			16 = 121_3, replacing 2 with 0 gives 101_3 = 10, so a(16) = 10.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) local t, r, i; t, r:= n, 0;
          for i from 0 while t>0 do
            r:= r+3^i*(d-> `if`(d=2, 0, d))(irem(t, 3, 't'))
          od; r
        end:
    seq(a(n), n=0..80);  # Alois P. Heinz, Jun 17 2014
  • Mathematica
    Array[FromDigits[IntegerDigits[#, 3] /. 2 -> 0, 3] &, 72, 0] (* Michael De Vlieger, Mar 17 2018 *)
  • PARI
    a(n) = my(d=digits(n, 3)); fromdigits(apply(x->(if (x==2, 0, x)), d), 3); \\ Michel Marcus, Jun 10 2017
  • Python
    from sympy.ntheory.factor_ import digits
    def a(n):return int("".join(map(str, digits(n, 3)[1:])).replace('2', '0'), 3) # Indranil Ghosh, Jun 10 2017
    

Formula

a(n) = n - 2 * A005836(A289814(n) + 1) = A005836(A289813(n) + 1). - Andrey Zabolotskiy, Nov 11 2019

A140263 Permutation of nonnegative integers obtained by interleaving A117967 and A117968.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, May 19 2008, originally described in a posting at the SeqFan mailing list on Sep 15 2005

Keywords

Crossrefs

Inverse: A140264. Bisections: A117967 & A117968. a(n) = A140265(n+1)-1.

Programs

  • Python
    from sympy import ceiling
    from sympy.ntheory.factor_ import digits
    def a004488(n): return int("".join([str((3 - i)%3) for i in digits(n, 3)[1:]]), 3)
    def a117968(n):
        if n==1: return 2
        if n%3==0: return 3*a117968(n/3)
        elif n%3==1: return 3*a117968((n - 1)/3) + 2
        else: return 3*a117968((n + 1)/3) + 1
    def a117967(n): return 0 if n==0 else a117968(-n) if n<0 else a004488(a117968(n))
    def a001057(n): return -(-1)**n*ceiling(n/2)
    def a(n): return a117967(a001057(n)) # Indranil Ghosh, Jun 07 2017

Formula

a(n) = A117967(A001057(n)). (Assuming that the domain of A117967 is the whole Z line.)

A242399 Write n and 3n in ternary representation and add all trits modulo 3.

Original entry on oeis.org

0, 4, 8, 12, 16, 11, 24, 19, 23, 36, 40, 44, 48, 52, 47, 33, 28, 32, 72, 76, 80, 57, 61, 56, 69, 64, 68, 108, 112, 116, 120, 124, 119, 132, 127, 131, 144, 148, 152, 156, 160, 155, 141, 136, 140, 99, 103, 107, 84, 88, 83, 96, 91, 95, 216, 220, 224, 228, 232
Offset: 0

Views

Author

Reinhard Zumkeller, May 13 2014

Keywords

Examples

			n = 25, 3*n = 75:
.  A007089(25) =  221
.  A007089(75) = 2210
.   add trits    ----
.    modulo 3    2101 = A007089(64), hence a(25) = 64.
		

Crossrefs

Programs

  • Haskell
    a242399 n = foldr (\t v -> 3 * v + t) 0 $
                      map (flip mod 3) $ zipWith (+) ([0] ++ ts) (ts ++ [0])
                where ts = a030341_row n

Formula

a(n) <= 4*n; a(m) = 4*m iff m is a term of A242407.
a(n) = A008586(n) - A242400(n).

A246207 Permutation of nonnegative integers: a(0) = 0, a(1) = 1, a(2n) = A117968(a(n)), a(2n+1) = A117967(1+a(n)).

Original entry on oeis.org

0, 1, 2, 5, 7, 3, 22, 15, 23, 11, 6, 4, 71, 35, 66, 52, 58, 33, 25, 12, 21, 16, 8, 17, 172, 99, 73, 36, 213, 148, 194, 137, 197, 152, 75, 43, 59, 29, 24, 13, 69, 49, 68, 47, 19, 9, 64, 45, 587, 419, 225, 127, 173, 104, 72, 37, 516, 304, 620, 431, 643, 447, 601, 462, 640, 441, 577, 423, 177, 103, 203, 155, 211, 150, 61, 30, 57, 34, 26, 53
Offset: 0

Views

Author

Antti Karttunen, Aug 19 2014

Keywords

Comments

This is an instance of entanglement permutation, where complementary pair A005843/A005408 (even and odd numbers respectively) is entangled with complementary pair A117968/A117967 (negative and positive part of inverse of balanced ternary enumeration of integers, respectively), with a(0) set to 0 and a(1) set to 1.
Thus this shares with A140263 the property that after a(0)=0, the even positions contain only terms of A117968 and the odd positions contain only terms of A117967.

Crossrefs

Inverse: A246208.
Related permutations: A140263, A054429, A246209, A246211.

Programs

  • Python
    from sympy.ntheory.factor_ import digits
    def a004488(n): return int("".join([str((3 - i)%3) for i in digits(n, 3)[1:]]), 3)
    def a117968(n):
        if n==1: return 2
        if n%3==0: return 3*a117968(n/3)
        elif n%3==1: return 3*a117968((n - 1)/3) + 2
        else: return 3*a117968((n + 1)/3) + 1
    def a117967(n): return 0 if n==0 else a117968(-n) if n<0 else a004488(a117968(n))
    def a(n): return n if n<2 else a117968(a(n/2)) if n%2==0 else a117967(1 + a((n - 1)/2)) # Indranil Ghosh, Jun 07 2017

Formula

As a composition of related permutations:
a(n) = A246209(A054429(n)).
a(n) = A246211(A246209(n)).
Previous Showing 11-20 of 60 results. Next