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.

A004468 a(n) = Nim product 3 * n.

Original entry on oeis.org

0, 3, 1, 2, 12, 15, 13, 14, 4, 7, 5, 6, 8, 11, 9, 10, 48, 51, 49, 50, 60, 63, 61, 62, 52, 55, 53, 54, 56, 59, 57, 58, 16, 19, 17, 18, 28, 31, 29, 30, 20, 23, 21, 22, 24, 27, 25, 26, 32, 35, 33, 34, 44, 47, 45, 46, 36, 39, 37, 38, 40, 43, 41, 42, 192, 195, 193, 194, 204, 207, 205
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 3,1,2.
This is a permutation of the natural numbers; A006015 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.

Crossrefs

Row 3 of array in A051775.

Programs

  • Maple
    read("transforms") ;
    # insert Maple procedures nimprodP2() and A051775() of the b-file in A051775 here.
    A004468 := proc(n)
            A051775(3,n) ;
    end proc:
    L := [seq(A004468(n),n=0..1000)] ; # R. J. Mathar, May 28 2011
    # second Maple program:
    a:= proc(n) option remember; `if`(n=0, 0,
          a(iquo(n, 4, 'r'))*4+[0, 3, 1, 2][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, 3, 1, 2}[[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,3,1,2]); for(i=1, #v, v[i] = w[v[i]+1]); fromdigits(v, 4) \\ Jianing Song, Aug 10 2022
    
  • Python
    def a(n, D=[0, 3, 1, 2]):
        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

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