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

A003987 Table of n XOR m (or Nim-sum of n and m) read by antidiagonals with m>=0, n>=0.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Another way to construct the array: construct an infinite square matrix starting in the top left corner using the rule that each entry is the smallest nonnegative number that is not in the row to your left or in the column above you.
After a few moves the [symmetric] matrix looks like this:
0 1 2 3 4 5 ...
1 0 3 2 5 ...
2 3 0 1 ?
3 2 1
4 5 ?
5
The ? is then replaced with a 6.

Examples

			Table begins
   0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, ...
   1,  0,  3,  2,  5,  4,  7,  6,  9,  8, 11, 10, ...
   2,  3,  0,  1,  6,  7,  4,  5, 10, 11,  8, ...
   3,  2,  1,  0,  7,  6,  5,  4, 11, 10, ...
   4,  5,  6,  7,  0,  1,  2,  3, 12, ...
   5,  4,  7,  6,  1,  0,  3,  2, ...
   6,  7,  4,  5,  2,  3,  0, ...
   7,  6,  5,  4,  3,  2, ...
   8,  9, 10, 11, 12, ...
   9,  8, 11, 10, ...
  10, 11,  8, ...
  11, 10, ...
  12, ...
  ...
The first few antidiagonals are
   0;
   1,  1;
   2,  0,  2;
   3,  3,  3,  3;
   4,  2,  0,  2,  4;
   5,  5,  1,  1,  5,  5;
   6,  4,  6,  0,  6,  4,  6;
   7,  7,  7,  7,  7,  7,  7,  7;
   8,  6,  4,  6,  0,  6,  4,  6,  8;
   9,  9,  5,  5,  1,  1,  5,  5,  9,  9;
  10,  8, 10,  4,  2,  0,  2,  4, 10,  8, 10;
  11, 11, 11, 11,  3,  3,  3,  3, 11, 11, 11, 11;
  12, 10,  8, 10, 12,  2,  0,  2, 12, 10,  8, 10, 12;
  ...
[Symmetric] matrix in base 2:
     0    1   10   11  100  101,  110  111 1000 1001 1010 1011 ...
     1    0   11   10  101  100,  111  110 1001 1000 1011  ...
    10   11    0    1  110  111,  100  101 1010 1011  ...
    11   10    1    0  111  110,  101  100 1011  ...
   100  101  110  111    0    1    10   11  ...
   101  100  111  110    1    0    11  ...
   110  111  100  101   10   11   ...
   111  110  101  100   11  ...
  1000 1001 1010 1011  ...
  1001 1000 1011  ...
  1010 1011  ...
  1011  ...
   ...
		

References

  • E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 60.
  • J. H. Conway, On Numbers and Games. Academic Press, NY, 1976, pp. 51-53.
  • Eric Friedman, Scott M. Garrabrant, Ilona K. Phipps-Morgan, A. S. Landsberg and Urban Larsson, Geometric analysis of a generalized Wythoff game, in Games of no Chance 5, MSRI publ. Cambridge University Press, date?
  • D. Gale, Tracking the Automatic Ant and Other Mathematical Explorations, A Collection of Mathematical Entertainments Columns from The Mathematical Intelligencer, Springer, 1998; see p. 190. [From N. J. A. Sloane, Jul 14 2009]
  • R. K. Guy, Impartial games, pp. 35-55 of Combinatorial Games, ed. R. K. Guy, Proc. Sympos. Appl. Math., 43, Amer. Math. Soc., 1991.

Crossrefs

Initial rows are A001477, A004442, A004443, A004444, etc. Cf. A051775, A051776.
Cf. A003986 (OR), A004198 (AND), A221146 (carries).
Antidiagonal sums are in A006582.

Programs

  • Maple
    nimsum := proc(a,b) local t1,t2,t3,t4,l; t1 := convert(a+2^20,base,2); t2 := convert(b+2^20,base,2); t3 := evalm(t1+t2); map(x->x mod 2, t3); t4 := convert(evalm(%),list); l := convert(t4,base,2,10); sum(l[k]*10^(k-1), k=1..nops(l)); end; # memo: adjust 2^20 to be much bigger than a and b
    AT := array(0..N,0..N); for a from 0 to N do for b from a to N do AT[a,b] := nimsum(a,b); AT[b,a] := AT[a,b]; od: od:
    # alternative:
    read("transforms") :
    A003987 := proc(n,m)
        XORnos(n,m) ;
    end proc: # R. J. Mathar, Apr 17 2013
    seq(seq(Bits:-Xor(k,m-k),k=0..m),m=0..20); # Robert Israel, Dec 31 2015
  • Mathematica
    Flatten[Table[BitXor[b, a - b], {a, 0, 10}, {b, 0, a}]] (* BitXor and Nim Sum are equivalent *)
  • PARI
    tabl(nn) = {for(n=0, nn, for(k=0, n, print1(bitxor(k, n - k),", ");); print(););};
    tabl(13) \\ Indranil Ghosh, Mar 31 2017
    
  • Python
    for n in range(14):
        print([k^(n - k) for k in range(n + 1)]) # Indranil Ghosh, Mar 31 2017

Formula

T(2i,2j) = 2T(i,j), T(2i+1,2j) = 2T(i,j) + 1.

A335162 Array read by upward antidiagonals: T(n,k) (n >= 0, k >= 0) = nim k-th power of n.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Jun 08 2020

Keywords

Comments

Although the nim-addition table (A003987) and nim-multiplication table (A051775) can be found in Conway's "On Numbers and Games", and in the Berlekamp-Conway-Guy "Winning Ways", this exponentiation-table seems to have been omitted.
The n-th row is A212200(n)-periodic. - Rémy Sigrist, Jun 12 2020

Examples

			The array begins:
  1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  0, 0, ...,
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  1, 1, ...,
  1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1,  2, 3, ...,
  1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1,  3, 2, ...,
  1, 4, 6,14, 5, 2, 8,11, 7,10, 3,12,13, 9,15, 1,  4, 6, ...,
  1, 5, 7,13, 4, 2,10, 9, 6, 8, 3,15,14,11,12, 1,  5, 7, ...,
  1, 6, 5, 8, 7, 3,13,15, 4,14, 2,11,10,12, 9, 1,  6, 5, ...,
  1, 7, 4,10, 6, 3,14,12, 5,13, 2, 9, 8,15,11, 1,  7, 4, ...,
  1, 8,13,14,10, 1, 8,13,14,10, 1, 8,13,14,10, 1,  8,13, ...,
  1, 9,12,10,11, 2,14, 4,15,13, 3, 7, 8, 5, 6, 1,  9,12, ...,
  1,10,14,13, 8, 1,10,14,13, 8, 1,10,14,13, 8, 1, 10,14, ...,
  1,11,15, 8, 9, 2,13, 5,12,14, 3, 6,10, 4, 7, 1, 11,15, ...,
  1,12,11,14,15, 3, 8, 6, 9,10, 2, 4,13, 7, 5, 1, 12,11, ...,
  1,13,10, 8,14, 1,13,10, 8,14, 1,13,10, 8,14, 1, 13,10, ...,
  1,14, 8,10,13, 1,14, 8,10,13, 1,14, 8,10,13, 1, 14, 8, ...,
  1,15, 9,13,12, 3,10, 7,11, 8, 2, 5,14, 6, 4, 1, 15, 9, ...
  ...
The initial antidiagonals are:
  [1]
  [1,  0]
  [1,  1,  0]
  [1,  2,  1,  0]
  [1,  3,  3,  1,  0]
  [1,  4,  2,  1,  1,  0]
  [1,  5,  6,  1,  2,  1,  0]
  [1,  6,  7, 14,  3,  3,  1,  0]
  [1,  7,  5, 13,  5,  2,  1,  1,  0]
  [1,  8,  4,  8,  4,  2,  1,  2,  1,  0]
  [1,  9, 13, 10,  7,  2,  8,  3,  3,  1,  0]
  [1, 10, 12, 14,  6,  3, 10, 11,  2,  1,  1,  0]
  [1, 11, 14, 10, 10,  3, 13,  9,  7,  1,  2,  1,  0]
  [1, 12, 15, 13, 11,  1, 14, 15,  6, 10,  3,  3,  1,  0]
  ...
		

Crossrefs

Rows: for nim-powers of 4 through 10 see A335163-A335169.
Columns: for nim-squares, cubes, fourth, fifth, sixth, seventh and eighth powers see A006042, A335170, A335535, A335171, A335172, A335173 and A335536.

Programs

  • PARI
    See Links section.

Formula

From Rémy Sigrist, Jun 12 2020: (Start)
T(n, A212200(n)) = 1 for any n > 0.
T(n, n) = A059971(n).
(End)

A051776 Table T(n,m) = Nim-product of n and m, read by antidiagonals, for n >= 1, m >= 1.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Dec 19 1999

Keywords

Examples

			Table begins:
  1  2  3  4  5  6 ...
  2  3  1  8 10 11 ...
  3  1  2 12 15 13 ...
  4  8 12  6  2 14 ...
		

References

  • J. H. Conway, On Numbers and Games, Academic Press, p. 52.

Crossrefs

Programs

  • Maple
    We continue from A003987: to compute a Nim-multiplication table using (a) an addition table AT := array(0..NA, 0..NA) and (b) a nimsum procedure for larger values; MT := array(0..N,0..N); for a from 0 to N do MT[a,0] := 0; MT[0,a] := 0; MT[a,1] := a; MT[1,a] := a; od: for a from 2 to N do for b from a to N do t1 := {}; for i from 0 to a-1 do for j from 0 to b-1 do u1 := MT[i,b]; u2 := MT[a,j];
    if u1<=NA and u2<=NA then u12 := AT[u1,u2]; else u12 := nimsum(u1,u2); fi; u3 := MT[i,j]; if u12<=NA and u3<=NA then u4 := AT[u12,u3]; else u4 := nimsum(u12,u3); fi; t1 := { op(t1), u4}; #t1 := { op(t1), AT[ AT[ MT[i,b], MT[a,j] ], MT[i,j] ] }; od; od;
    t2 := sort(convert(t1,list)); j := nops(t2); for i from 1 to nops(t2) do if t2[i] <> i-1 then j := i-1; break; fi; od; MT[a,b] := j; MT[b,a] := j; od; od;

Formula

T(n,m) = A051775(n,m).

A053398 Nim-values from game of Kopper's Nim.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Rows/columns 1-10 are A007814, A050603, A053399, A053384-A053890.
Comment from R. K. Guy: David Singmaster (zingmast(AT)sbu.ac.uk) sent me, about 5 years ago, a game he'd received from Bodo Koppers. It is played with two heaps of beans. The move is to remove one heap and split the other into two nonempty heaps. I'm not sure if Koppers invented it, or got it from elsewhere. I do not think that he analyzed it, but Singmaster did.

Crossrefs

Cf. A003986, A007814 (both edges & central terms & minima per row), A000523 (max per row), A245836 (row sums), A003987, A051775.

Programs

  • Haskell
    a053398 :: Int -> Int -> Int
    a053398 n k = a007814 $ a003986 (n - 1) (k - 1) + 1
    a053398_row n = map (a053398 n) [1..n]
    a053398_tabl = map a053398_row [1..]
    -- Reinhard Zumkeller, Aug 04 2014

Formula

a(x, y) = place of last zero bit of (x-1) OR (y-1).
T(n,k) = A007814(A003986(n-1,k-1)+1). - Reinhard Zumkeller, Aug 04 2014

A223541 Array T(m,n) = nim-product(2^m,2^n) (m>=0, n>=0) read by antidiagonals.

Original entry on oeis.org

1, 2, 2, 4, 3, 4, 8, 8, 8, 8, 16, 12, 6, 12, 16, 32, 32, 11, 11, 32, 32, 64, 48, 64, 13, 64, 48, 64, 128, 128, 128, 128, 128, 128, 128, 128, 256, 192, 96, 192, 24, 192, 96, 192, 256, 512, 512, 176, 176, 44, 44, 176, 176, 512, 512, 1024, 768
Offset: 0

Views

Author

Tilman Piesk, Mar 21 2013

Keywords

Comments

Nimber multiplication is commutative, so this array is symmetric, and can be represented in a more compact way by the rows of the lower triangle (A223540).
The diagonal is A006017 (nim-squares of powers of 2).
The elements of this array are listed in A223543. In the key-matrix A223542 the entries of this array (which become very large) are replaced by the corresponding index numbers of A223543. (Surprisingly, the key-matrix seems to be interesting on its own.)
The number of different entries per antidiagonal is probably A002487. That would mean that there are exactly A002487(n+1) numbers that can be expressed as a nim-product(2^a,2^b) with a+b=n. - Tilman Piesk, Mar 27 2013

Examples

			T(1,7) = T(3,5) = 192, the result of the nim-multiplications 2^1*2^7 and 2^3*2^5.
The array begins:
1,2,4,8,16,32,64,128,256,...
2,3,8,12,32,48,128,192,512,...
4,8,6,11,64,128,96,176,1024,...
8,12,11,13,128,192,176,208,2048,...
16,32,64,128,24,44,75,141,4096,...
32,48,128,192,44,52,141,198,8192,...
64,128,96,176,75,141,103,185,16384,...
128,192,176,208,141,198,185,222,32768,...
256,512,1024,2048,4096,8192,16384,32768,384,...
...
		

References

  • J. H. Conway, "Integral lexicographic codes." Discrete Mathematics 83.2-3 (1990): 219-235. See Table 4.

Crossrefs

Cf. A051775, A223540, A006017 (main diagonal), A223543, A223542, A000079, A002487.
For rows 1,2,3,4, see A134683, A335159, A335160, A335161.

Formula

T(m,n) = A051775(A000079(m),A000079(n)).
T(m,n) = A223543(A223542(m,n)).

Extensions

Edited by N. J. A. Sloane, Jun 08 2020

A212200 Multiplicative order of n in nim-multiplication.

Original entry on oeis.org

1, 3, 3, 15, 15, 15, 15, 5, 15, 5, 15, 15, 5, 5, 15, 85, 85, 255, 255, 85, 85, 255, 255, 85, 85, 255, 255, 255, 255, 85, 85, 255, 255, 255, 255, 85, 255, 85, 255, 255, 255, 255, 255, 255, 85, 255, 85, 255, 85, 85, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 85, 85, 255, 255, 51, 255, 255, 255, 51, 255, 255, 17, 255, 85, 255, 17, 255, 85
Offset: 1

Views

Author

N. J. A. Sloane, May 03 2012

Keywords

Comments

For n <= 255, computed using R. J. Mathar's Maple programs from A051775. a(256) = 21845 from J. H. Conway and Alex Ryba, May 04 2012
Apparently, all terms belong to A001317, and A001317(k) appears 2^k times. - Rémy Sigrist, Jun 14 2020
From Jianing Song, Aug 10 2022: (Start)
The observation above is incorrect. Note that {0,1,...,2^2^k-1} together with the nim operations makes a field isomorphic to GF(2^2^k). This means that:
- Every number is a divisor of a number of the form 2^2^k-1, and every divisor of 2^2^k-1 for some k appears;
- If d is a divisor of 2^2^k-1 for some k, then d appears phi(d) times among {a(1),a(2),...,a(2^2^m-1)} for all m >= k, phi = A000010. This means that if d > 1, and k is the smallest number such that d | 2^2^k-1, then d can only appear among {a(2^2^(k-1)),...a(2^2^k-1)}.
So the correct result should be: all terms are divisors of numbers of the form 2^2^k-1, and each divisor d appears phi(d) times.
For example, 641 would appear 640 times in this sequence, among {a(2^32),...,a(2^64-1)}, although to determine their positions is hard. (End)

Examples

			The nim-products 4*4*...*4 are (cf. A051775): 4, 4^2=6, 4^3=4*6=14, 4^4=4*14=5, 4^5=2, 4^6=8, ..., 4^14=15, 4^15=1, so 4 has order a(4) = 15.
		

References

  • J. H. Conway, On Numbers and Games, Academic Press, Chapter 6.

Crossrefs

A006042 The nim-square of n.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

This is a permutation of the natural numbers; A160679 is the inverse permutation. - Jianing Song, Aug 10 2022

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

Diagonal of A051775. Without 0, diagonal of A051776.
Column 2 of array in A335162.
Other nim k-th powers: A051917 (k=-1), A160679 (k=1/2), A335170 (k=3), A335535 (k=4), A335171 (k=5), A335172 (k=6), A335173 (k=7), A335536 (k=8).

Programs

Formula

a(n) = A051775(n,n).
From Jianing Song, Aug 10 2022: (Start)
If n = Sum_j 2^e(j), then a(n) is the XOR of A006017(e(j))'s. Proof: let N+ = XOR and N* denote the nim addition and the nim multiplication, then n N* n = (Sum_j 2^e(j)) N* (Sum_j 2^e(j)) = (Nim-sum_j 2^e(j)) N* (Nim-sum_j 2^e(j)) = (Nim-sum_j (2^e(j) N* 2^e(j))) N+ (Nim-sum_{i
For example, for n = 11 = 2^0 + 2^1 + 2^3, a(11) = A006017(0) XOR A006017(1) XOR A006017(3) = 1 XOR 3 XOR 13 = 15.
More generally, if n = Sum_j 2^e(j), k is a power of 2, then the nim k-th power of n is the XOR of (nim k-th power of 2^e(j))'s. (End)

Extensions

a(1)-a(49) confirmed, a(50)-a(71) added by John W. Layman, Nov 05 2010
a(0) prepended by Jianing Song, Aug 10 2022

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

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

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

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.

A051910 Triangle T(n,m) = Nim-product of n and m, read by rows, 0<=m<=n.

Original entry on oeis.org

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

Author

N. J. A. Sloane, Dec 20 1999

Keywords

Examples

			Triangle starts
0;
0, 1;
0, 2,  3;
0, 3,  1,  2;
0, 4,  8, 12,  6;
0, 5, 10, 15,  2,  7;
0, 6, 11, 13, 14,  8, 5;
0, 7,  9, 14, 10, 13, 3,  4;
0, 8, 12,  4, 11,  3, 7, 15, 13;
		

References

  • E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 60.
  • J. H. Conway, On Numbers and Games, Academic Press, p. 52.

Crossrefs

Programs

  • Maple
    We continue from A003987: to compute a Nim-multiplication table using (a) an addition table AT := array(0..NA, 0..NA) and (b) a nimsum procedure for larger values; MT := array(0..N,0..N); for a from 0 to N do MT[a,0] := 0; MT[0,a] := 0; MT[a,1] := a; MT[1,a] := a; od: for a from 2 to N do for b from a to N do t1 := {}; for i from 0 to a-1 do for j from 0 to b-1 do u1 := MT[i,b]; u2 := MT[a,j];
    if u1<=NA and u2<=NA then u12 := AT[u1,u2]; else u12 := nimsum(u1,u2); fi; u3 := MT[i,j]; if u12<=NA and u3<=NA then u4 := AT[u12,u3]; else u4 := nimsum(u12,u3); fi; t1 := { op(t1), u4}; #t1 := { op(t1), AT[ AT[ MT[i,b], MT[a,j] ], MT[i,j] ] }; od; od;
    t2 := sort(convert(t1,list)); j := nops(t2); for i from 1 to nops(t2) do if t2[i] <> i-1 then j := i-1; break; fi; od; MT[a,b] := j; MT[b,a] := j; od; od;

Formula

T(n,m) = A051775(n,m) = A051776(n,m).
Showing 1-10 of 29 results. Next