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

A006015 Nim product 2*n.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

From Jianing Song, Aug 10 2022: (Start)
Write n in quaternary (base 4), then replace each 1,2,3 by 2,3,1.
This is a permutation of the natural numbers; A004468 is the inverse permutation (since the nim product of 2 and 3 is 1). (End)

References

  • J. H. Conway, On Numbers and Games. Academic Press, NY, 1976, pp. 51-53.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Row 2 of array in A051775.

Programs

  • Maple
    a:= proc(n) option remember; `if`(n=0, 0,
          a(iquo(n, 4, 'r'))*4+[0, 2, 3, 1][r+1])
        end:
    seq(a(n), n=0..70);  # Alois P. Heinz, Jan 25 2022
  • Mathematica
    a[n_] := a[n] = If[n == 0, 0, {q, r} = QuotientRemainder[n, 4]; a[q]*4 + {0, 2, 3, 1}[[r + 1]]];
    Table[a[n], {n, 0, 70}] (* Jean-François Alcover, May 20 2022, after Alois P. Heinz *)
  • PARI
    a(n) = my(v=digits(n, 4), w=[0,2,3,1]); for(i=1, #v, v[i] = w[v[i]+1]); fromdigits(v, 4) \\ Jianing Song, Aug 10 2022
    
  • Python
    def a(n, D=[0, 2, 3, 1]):
        r, k = 0, 0
        while n>0: r+=D[n%4]*4**k; n//=4; k+=1
        return r
    # Onur Ozkan, Mar 07 2023

Formula

From Jianing Song, Aug 10 2022: (Start)
a(n) = A051775(2,n).
a(n) = 2*n if n has only digits 0 or 1 in quaternary (n is in A000695). Otherwise, a(n) < 2*n.
a(n) = n/3 if n has only digits 0 or 3 in quaternary (n is in A001196). Otherwise, a(n) > n/3.
a(n) = 3*n/2 if and only if n has only digits 0 or 2 in quaternary (n is in A062880). Proof: let n = Sum_i d_i*4^i, d(i) = 0,1,2,3. Write A = Sum_{d_i=1} 4^i, B = Sum_{d_i=3} 4^i, then a(n) = 3*n/2 if and only if 2*A + B = 3/2*(A + 3*B), or A = 7*B. If B != 0, then B is of the form (4*s+1)*4^t, but 7*B is not of this form. So the only possible case is A = B = 0, namely n has only digits 0 or 2. (End)

Extensions

More terms from Erich Friedman.

A334290 Array read by upward antidiagonals: T(n,k) (n > 0, k > 0) = nim-division of n by k.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Jun 13 2020

Keywords

Comments

Each row and each column is a permutation of the natural numbers.

Examples

			The array begins:
  n\k|   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15
  ---+------------------------------------------------------------
    1|   1   3   2  15  12   9  11  10   6   8   7   5  14  13   4 --> A051917(n)
    2|   2   1   3   5   4  14  13  15  11  12   9  10   7   6   8
    3|   3   2   1  10   8   7   6   5  13   4  14  15   9  11  12
    4|   4  12   8   1  13  15   7   3  14  11  10   2   5   9   6
    5|   5  15  10  14   1   6  12   9   8   3  13   7  11   4   2
    6|   6  13  11   4   9   1  10  12   5   7   3   8   2  15  14
    7|   7  14   9  11   5   8   1   6   3  15   4  13  12   2  10
    8|   8   4  12   2   6   5   9   1   7  13  15   3  10  14  11
    9|   9   7  14  13  10  12   2  11   1   5   8   6   4   3  15
   10|  10   5  15   7   2  11   4  14  12   1   6   9  13   8   3
   11|  11   6  13   8  14   2  15   4  10   9   1  12   3   5   7
   12|  12   8   4   3  11  10  14   2   9   6   5   1  15   7  13
   13|  13  11   6  12   7   3   5   8  15  14   2   4   1  10   9
   14|  14   9   7   6  15   4   3  13   2  10  12  11   8   1   5
   15|  15  10   5   9   3  13   8   7   4   2  11  14   6  12   1
             |   |   |   |   |
             |   |   |   |   A004474(n)
             |   |   |   A004477(n)
             |   |   A004480(n)
             |   A006015(n)
             A004468(n)
		

Crossrefs

Programs

  • PARI
    See Links section.

Formula

T(n, k) = A051776(n, A051917(k)).
T(n, 1) = n.
T(1, n) = A051917(k).
T(n, n) = 1.

A334291 Array read by upward antidiagonals: T(n,k) (n >= 0, k > 0) = nim-division of n by k.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Jun 13 2020

Keywords

Comments

This is the array A334290 with a leading row of 0's.

Examples

			The array begins:
  n\k|   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15
  ---+------------------------------------------------------------
    0|   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
    1|   1   3   2  15  12   9  11  10   6   8   7   5  14  13   4 --> A051917(n)
    2|   2   1   3   5   4  14  13  15  11  12   9  10   7   6   8
    3|   3   2   1  10   8   7   6   5  13   4  14  15   9  11  12
    4|   4  12   8   1  13  15   7   3  14  11  10   2   5   9   6
    5|   5  15  10  14   1   6  12   9   8   3  13   7  11   4   2
    6|   6  13  11   4   9   1  10  12   5   7   3   8   2  15  14
    7|   7  14   9  11   5   8   1   6   3  15   4  13  12   2  10
    8|   8   4  12   2   6   5   9   1   7  13  15   3  10  14  11
    9|   9   7  14  13  10  12   2  11   1   5   8   6   4   3  15
   10|  10   5  15   7   2  11   4  14  12   1   6   9  13   8   3
   11|  11   6  13   8  14   2  15   4  10   9   1  12   3   5   7
   12|  12   8   4   3  11  10  14   2   9   6   5   1  15   7  13
   13|  13  11   6  12   7   3   5   8  15  14   2   4   1  10   9
   14|  14   9   7   6  15   4   3  13   2  10  12  11   8   1   5
   15|  15  10   5   9   3  13   8   7   4   2  11  14   6  12   1
             |   |   |   |   |
             |   |   |   |   A004474(n)
             |   |   |   A004477(n)
             |   |   A004480(n)
             |   A006015(n)
             A004468(n)
		

Crossrefs

Formula

T(n, k) = A051775(n, A051917(k)).
T(n, 1) = n.
T(1, n) = A051917(k).
T(n, n) = 1.
Showing 1-3 of 3 results.