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

A004482 Tersum n + 1 (answer recorded in base 10).

Original entry on oeis.org

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

Views

Author

Keywords

Comments

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.
Sprague-Grundy values for game of Wyt Queens.

References

  • E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 76.

Crossrefs

This sequence is row 1 of table A004481.
a(n) = A061347(n+1) + n.
Third column of triangle A296339.

Programs

  • Mathematica
    LinearRecurrence[{1,0,1,-1},{1,2,0,4},70] (* or *) Table[3*Floor[n/3]+ Mod[ n+1,3],{n,0,70}] (* Harvey P. Dale, Nov 29 2014 *)

Formula

Periodic with period 3 and saltus 3: a(n) = 3*floor(n/3) + ((n+1) mod 3).
a(n) = n - 2*cos(2*(n+1)*Pi/3). - Wesley Ivan Hurt, Sep 29 2017
Sum_{n>=3} (-1)^(n+1)/a(n) = 1/2 - log(2)/3. - Amiram Eldar, Aug 21 2023

Extensions

More terms from Erich Friedman

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

A018219 Table T(a,b) by antidiagonals of winning positions in 3-pile Wythoff game (a square array).

Original entry on oeis.org

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

Views

Author

Keywords

Comments

(a,b,T(a,b)) are the winning positions in 3-pile Wythoff game. A move in k-pile Wythoff is: pick a subset of the k piles and remove the same number of stones from each. Goal: take the last stone.
T(a,b) = T(b,a). If T(a,b)=c then T(a,c)=b and T(b,c)=a.

Examples

			0 2 1 5 7 ...
2 4 0 3 1 ...
1 0 6 8 10 ...
5 3 8 1 4 ...
7 1 10 4 3 ...
T(1,1)=4, since from (114) your opponent can move to (113),(112),(111),(110),(014),(013),(004),(003). You can either win or move to (012) and win a move later.
		

Crossrefs

Rows 0-3: A002251, A018220-A018222. Main diagonal: A051261.
T(a, b)=0 iff A004481(a, b)=0 iff A002251(a)=b.

Programs

  • Mathematica
    mex[ s_ ] := Min[ Complement[ Range[ 0, Max[ {s, -1} ]+1 ], Flatten[ s ] ] ]; f[ s_ ] := Join[ s, s+Table[ i, {i, Length[ s ]} ] ]; T[ a_, b_ ] := T[ a, b ] = mex[ { f[ Table[ T[ a-i, b ], {i, a} ] ], f[ Table[ T[ a, b-i ], {i, b} ] ], f[ Table[ T[ a-i, b-i ], {i, Min[ a, b ]} ] ] } ]

Extensions

Edited and extended by Christian G. Bower, Oct 29 2002

A307296 Array read by antidiagonals: Sprague-Grundy values for the game NimHof with 4 rules [1,0], [3,2], [1,1], [0,1].

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, 1, 8, 0, 8, 8, 8, 9, 6, 6, 0, 2, 2, 1, 6, 6, 9, 10, 10, 7, 2, 9, 7, 9, 2, 7, 10, 10, 11, 11, 11, 9, 10, 10, 10, 0, 9, 11, 11, 11, 12, 9, 9, 12, 0, 11, 3, 11, 1, 12, 9, 9, 12
Offset: 0

Views

Author

N. J. A. Sloane, Apr 12 2019

Keywords

Comments

The game NimHof with a list of rules R means that for each rule [a,b] you can move from cell [x,y] to any cell [x-i*a,y-i*b] as long as neither coordinate is negative. See the Friedman et al. article for further details.

Examples

			The initial antidiagonals are:
  [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, 1, 8, 0, 8, 8, 8],
  [9, 6, 6, 0, 2, 2, 1, 6, 6, 9],
  [10, 10, 7, 2, 9, 7, 9, 2, 7, 10, 10],
  [11, 11, 11, 9, 10, 10, 10, 0, 9, 11, 11, 11],
  [12, 9, 9, 12, 0, 11, 3, 11, 1, 12, 9, 9, 12],
The triangle begins:
  [1, 2, 0, 4, 5, 3, 7, 8, 6, 10, 11, 9]
  [2, 0, 1, 5, 3, 4, 8, 6, 7, 11, 9]
  [3, 4, 5, 6, 7, 0, 1, 2, 9, 12]
  [4, 5, 3, 7, 8, 2, 9, 0, 1]
  [5, 3, 4, 1, 2, 7, 10, 11]
  [6, 7, 8, 0, 9, 10, 3]
  [7, 8, 6, 2, 10, 11]
  [8, 6, 7, 9, 0]
  [9, 10, 11, 12]
  [10, 11, 9]
  [11, 9]
  [12]
  ...
		

References

  • 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?

Crossrefs

List of NimHof sequences:
A-number Rules R
A003987 [1,0], [0,1]
A004481 [1,0], [1,1], [0,1]
A003987 [1,0], [2,1], [0,1]
A307300 [1,0], [2,2], [0,1]
A307301 [1,0], [3,1], [0,1]
A003987 [1,0], [3,2], [0,1]
A307302 [1,0], [3,3], [0,1]
A307299 [1,0], [1,1], [1,2], [0,1]
A307296 [1,0], [1,1], [3,2], [0,1]
A307297 [1,0], [2,1], [3,3], [0,1]
A307298 [1,0], [1,1], [1,2], [2,3], [0,1]

Programs

  • PARI
    \\ See Links section.

A004483 Tersum n + 2.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

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.
Also Sprague-Grundy values for game of Wyt Queens.

References

  • E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 76.

Crossrefs

This sequence is row 2 of table A004481.
Second column of triangle in A296339.

Programs

  • Mathematica
    a[n_] := If[Divisible[n, 3], n+2, n-1]; Table[a[n], {n, 0, 70}] (* Jean-François Alcover, Oct 25 2013 *)
    LinearRecurrence[{1,0,1,-1},{2,0,1,5},70] (* Harvey P. Dale, Feb 07 2018 *)

Formula

Periodic with period and saltus 3: a(n) = 3*floor(n/3) + ((n+2) mod 3).
a(n) = n + 2*cos(2*n*Pi/3). - Wesley Ivan Hurt, Sep 27 2017
From R. J. Mathar, Dec 14 2017: (Start)
G.f.: ( 2+x^2+2*x^3-2*x ) / ( (1+x+x^2)*(x-1)^2 ).
a(n) = n + A099837(n) if n > 0. (End)
Sum_{n>=2} (-1)^n/a(n) = 2*Pi/(3*sqrt(3)) + log(2)/3 - 1/2. - Amiram Eldar, Aug 21 2023

Extensions

Edited by N. J. A. Sloane at the suggestion of Philippe Deléham, Nov 20 2007

A047708 Diagonal of Sprague-Grundy function for Wyt Queens (Wythoff's game).

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Since Wythoff(m,n) <= m+n, Wythoff(n,n) <= 2n. It is not known whether there is an efficient (linear in log(m)+log(n)) strategy to compute Wythoff(m,n). Each single row is "easy" in the sense that a+n-Wythoff(a,n) is eventually periodic. - Howard A. Landman.
Inverse of sequence A048850 considered as a permutation of the nonnegative integers. - Howard A. Landman, Sep 25 2001
Comments from Howard A. Landman, Nov 24 2007: (Start)
It is impossible for any integer to appear twice in this sequence because of the way it is constructed. Thus to prove that it is a permutation of the integers, we need only show that every value g appears at least once.
Suppose this were not true; then there must be some g such that for any value of n, G(n,n) is not = g. Since G(n,n) is defined to be the smallest number not found as a G(k,n), G(n,k), or G(k,k) for k < n, this can only happen in one of 2 ways: either there is a number g' smaller than g which is chosen (this can occur at most g times) or g already appears as both G(n,k) and G(k,n) for some k < n (because G(n,k) = G(k,n)) (this can happen at most n/2 times).
Thus we have n <= n/2 + g, or n <= 2g; if g has not appeared within the first 2g terms we have a contradiction. Therefore not only must every integer g appear in the sequence, but it must appear within the first 2g terms (and no sooner than term g/2, since G(n,n) <= 2n). Conversely, this also proves that n/2 <= A(n) = G(n,n) <= 2n. (End)

References

  • E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 76.
  • Howard A. Landman, "A Simple FSM-Based Proof of the Additive Periodicity of the Sprague-Grundy Function of Wythoff's Game", in R. Nowakowski (ed.), More Games of No Chance.
  • Howard A. Landman and Tom Ferguson showed that this is a permutation of the integers at the Jul 24-28 2000 MSRI workshop on combinatorial games.
  • W. A. Wythoff, "A Modification of the Game of Nim". Nieuw Arch. Wiskunde 8, 199-202, 1907/1909.

Crossrefs

Main diagonal of square array in A004481. Sequences A000201 and A001950 give the m and n coordinates of the zeros of Wythoff (i.e., the P-positions of the game, where the previous player has won).
Cf. A048850.

Programs

  • Mathematica
    mex[list_] :=  mex[list] = Min[Complement[Range[0, Length[list]], list]];
    move[Wnim, {a_, b_}] :=  move[Wnim, {a, b}] =
       Union[Table[{i, b}, {i, 0, a - 1}], Table[{a, i}, {i, 0, b - 1}],
        Table[{a - i, b - i}, {i, 1, Min[a, b]}]];
    SpragueGrundy[game_, list_] :=  SpragueGrundy[game, list] =
       mex[SpragueGrundy[game, #] & /@ move[game, list]];
    Table[SpragueGrundy[Wnim, {i, i}], {i, 0, 64}] (* Birkas Gyorgy, Apr 19 2011 *)
  • PARI
    See Links section.

Extensions

More terms from Howard A. Landman

A004486 Sprague-Grundy values for game of Wyt Queens.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Inverse of sequence A064208 considered as a permutation of the nonnegative integers. - Howard A. Landman, Sep 25 2001

References

  • E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 76.

Crossrefs

This sequence is row 5 of table A004481.

Extensions

More terms from Howard A. Landman

A004487 Sprague-Grundy values for game of Wyt Queens.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Inverse of sequence A064211 considered as a permutation of the positive integers. - Howard A. Landman, Sep 25 2001

References

  • E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 76.

Crossrefs

This sequence is row 6 of table A004481.

Extensions

More terms from Howard A. Landman

A046876 Length of runs in the sequence of row/column periods of Sprague-Grundy values of Wythoff's Game (A046875).

Original entry on oeis.org

1, 2, 1, 1, 1, 1, 4, 2, 3, 2, 3, 23, 24, 3, 20, 18, 84, 25, 43
Offset: 1

Views

Author

Keywords

Comments

a(20) >= 12. - Sean A. Irvine, May 02 2021

Crossrefs

Extensions

Entry revised by Sean A. Irvine, May 02 2021

A317205 Sprague-Grundy values for Wythoff's game.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Aug 07 2018

Keywords

Examples

			Triangle begins as:
  0;
  1,  2;
  2,  0,  1;
  3,  4,  5,  6;
  4,  5,  3,  2,  7;
  5,  3,  4,  0,  6,  8;
  6,  7,  8,  1,  9, 10,  3;
  7,  8,  6,  9,  0,  1,  4,  5;
		

References

  • E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 76.

Crossrefs

See A004481 for the full table.

Programs

  • Mathematica
    mex[list_] := mex[list] = Min[Complement[Range[0, Length[list]], list]];
    move[Wnim, {a_, b_}] := move[Wnim, {a, b}] =
       Union[Table[{i, b}, {i, 0, a - 1}], Table[{a, i}, {i, 0, b - 1}],
        Table[{a - i, b - i}, {i, 1, Min[a, b]}]];
    SpragueGrundy[game_, list_] := SpragueGrundy[game, list] =
       mex[SpragueGrundy[game, #] & /@ move[game, list]];
    t[n_, m_] := SpragueGrundy[Wnim, {n - 1, m - 1}]; (* so far copied from A004481 *)
    Flatten[Table[t[n, m], {n, 12}, {m,1, n}]] (* Georg Fischer, Feb 22 2020 *)

Extensions

More terms from Georg Fischer, Feb 22 2020
Showing 1-10 of 12 results. Next