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

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.

A004442 Natural numbers, pairs reversed: a(n) = n + (-1)^n; also Nimsum n + 1.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

A self-inverse permutation of the natural numbers.
Nonnegative numbers rearranged with least disturbance to maintain a(n) not equal to n. - Amarnath Murthy, Sep 13 2002
Essentially lodumo_2 of A059841. - Philippe Deléham, Apr 26 2009
a(n) = A180176(n) for n >= 20. - Reinhard Zumkeller, Aug 15 2010

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.

Crossrefs

Programs

  • Haskell
    import Data.List (transpose)
    import Data.Bits (xor)
    a004442 = xor 1 :: Integer -> Integer
    a004442_list = concat $ transpose [a005408_list, a005843_list]
    -- Reinhard Zumkeller, Jun 23 2013, Feb 01 2013, Oct 20 2011
    
  • Maple
    a[0]:=1:a[1]:=0:for n from 2 to 70 do a[n]:=a[n-2]+2 od: seq(a[n], n=0..68); # Zerinvary Lajos, Feb 19 2008
  • Mathematica
    Table[n + (-1)^n, {n, 0, 72}] (* or *)
    CoefficientList[Series[(1 - x + 2x^2)/((1 - x)(1 - x^2)), {x, 0, 72}], x] (* Robert G. Wilson v, Jun 16 2006 *)
    Flatten[Reverse/@Partition[Range[0,69],2]] (* or *) LinearRecurrence[{1,1,-1},{1,0,3},70] (* Harvey P. Dale, Jul 29 2018 *)
  • PARI
    a(n)=n+(-1)^n \\ Charles R Greathouse IV, Nov 20 2012
    
  • PARI
    Vec((1-x+2*x^2)/((1-x)*(1-x^2)) + O(x^100)) \\ Altug Alkan, Feb 04 2016
    
  • Python
    def a(n): return n^1
    print([a(n) for n in range(69)]) # Michael S. Branicky, Jan 23 2022

Formula

a(n) = n XOR 1. - Odimar Fabeny, Sep 05 2004
G.f.: (1-x+2x^2)/((1-x)*(1-x^2)). - Mitchell Harris, Jan 10 2005
a(n+1) = lod_2(A059841(n)). - Philippe Deléham, Apr 26 2009
a(n) = 2*n - a(n-1) - 1 with n > 0, a(0)=1. - Vincenzo Librandi, Nov 18 2010
a(n) = Sum_{k=1..n-1} (-1)^(n-1-k)*C(n+1,k). - Mircea Merca, Feb 07 2013
For n > 1, a(n)^a(n) == 1 (mod n). - Thomas Ordowski, Jan 04 2016
Sum_{n>=0,n<>1} (-1)^n/a(n) = log(2) = A002162. - Peter McNair, Aug 07 2023

Extensions

Offset adjusted by Reinhard Zumkeller, Mar 05 2010

A120634 Decimal equivalent of A066335.

Original entry on oeis.org

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

Views

Author

Joshua Zucker, Jun 21 2006

Keywords

Comments

The same as A004444 except for first 3 terms. - Pietro Battiston, Jan 19 2008

Crossrefs

Programs

  • Mathematica
    LinearRecurrence[{1,0,0,1,-1},{0,7,6,5,4},80] (* Harvey P. Dale, May 10 2015 *)
  • PARI
    concat(0, Vec(-x*(x^3+x^2+x-7)/((x-1)^2*(x+1)*(x^2+1)) + O(x^100))) \\ Colin Barker, Oct 06 2014

Formula

From Colin Barker, Oct 06 2014: (Start)
a(n) = (3-(-1)^n-(1-i)*((-i)^n+i*i^n)+n) where i=sqrt(-1).
a(n) = a(n-1)+a(n-4)-a(n-5).
G.f.: -x*(x^3+x^2+x-7) / ((x-1)^2*(x+1)*(x^2+1)).
(End)

A210635 Array read by descending antidiagonals: a(n,w) = ((w - (n mod w) - 1) + n) - (n mod w), n >= 0, w >= 1.

Original entry on oeis.org

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

Views

Author

Lucas Beristayn, Mar 25 2012

Keywords

Comments

Each column is a permutation of the nonnegative integers.
Column w can be used to mirror horizontally an infinite rectangular image of width w stored in a array of pixels. The pixels in the first row of the image are numbered from 0 to w-1 and subsequent rows continue the numbering likewise.

Examples

			The transposed array begins:
  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 ...
  1  0  3  2  5  4  7  6  9  8 11 10 13 12 15 14 17 16 19 18 ...
  2  1  0  5  4  3  8  7  6 11 10  9 14 13 12 17 16 15 20 19 ...
  3  2  1  0  7  6  5  4 11 10  9  8 15 14 13 12 19 18 17 16 ...
  4  3  2  1  0  9  8  7  6  5 14 13 12 11 10 19 18 17 16 15 ...
  5  4  3  2  1  0 11 10  9  8  7  6 17 16 15 14 13 12 23 22 ...
  6  5  4  3  2  1  0 13 12 11 10  9  8  7 20 19 18 17 16 15 ...
  7  6  5  4  3  2  1  0 15 14 13 12 11 10  9  8 23 22 21 20 ...
  8  7  6  5  4  3  2  1  0 17 16 15 14 13 12 11 10  9 26 25 ...
  9  8  7  6  5  4  3  2  1  0 19 18 17 16 15 14 13 12 11 10 ......
		

Crossrefs

Column 2: A004442, column 3: A330396, column 4: A004444, column 8: A004448.

Programs

  • Maple
    a:= (n,w) ->  ((w - (n mod w) - 1) + n) - (n mod w):
    seq(seq(a(n,1+d-n), n=0..d), d=0..12);  # Alois P. Heinz, Jun 07 2023
  • PARI
    a(n,w) = ((w - n % w - 1) + n) - n % w;
    matrix(7, 7, n, k, a(k-1, n)) \\ Michel Marcus, Jun 07 2023

Formula

a(n,w) = ((w - (n mod w) - 1) + n) - (n mod w).

Extensions

Edited by N. J. A. Sloane, Mar 26 2012
Entry revised by Editors of the OEIS, Jun 17 2023
Showing 1-4 of 4 results.