Original entry on oeis.org
0, 2, 1, 6, 8, 7, 3, 5, 4, 18, 20, 19, 24, 26, 25, 21, 23, 22, 9, 11, 10, 15, 17, 16, 12, 14, 13, 54, 56, 55, 60, 62, 61, 57, 59, 58, 72, 74, 73, 78, 80, 79, 75, 77, 76, 63, 65, 64, 69, 71, 70, 66, 68, 67, 27, 29, 28, 33, 35, 34, 30, 32, 31, 45, 47, 46, 51
Offset: 0
Cf.
A048647,
A055115,
A055116,
A055120,
A059249,
A117966,
A117967,
A117968,
A225901,
A242399,
A244042,
A263273,
A289813,
A289814,
A289815,
A289816,
A289831,
A289838,
A300222,
A321464.
-
a004488 0 = 0
a004488 n = if d == 0 then 3 * a004488 n' else 3 * a004488 n' + 3 - d
where (n', d) = divMod n 3
-- Reinhard Zumkeller, Mar 12 2014
-
a:= proc(n) local t, r, i;
t, r:= n, 0;
for i from 0 while t>0 do
r:= r+3^i *irem(2*irem(t, 3, 't'), 3)
od; r
end:
seq(a(n), n=0..80); # Alois P. Heinz, Sep 07 2011
-
a[n_] := FromDigits[Mod[3-IntegerDigits[n, 3], 3], 3]; Table[a[n], {n, 0, 66}] (* Jean-François Alcover, Mar 03 2014 *)
-
a(n) = my(b=3); fromdigits(apply(d->(b-d)%b, digits(n, b)), b);
vector(67, i, a(i-1)) \\ Gheorghe Coserea, Apr 23 2018
-
from sympy.ntheory.factor_ import digits
def a(n): return int("".join([str((3 - i)%3) for i in digits(n, 3)[1:]]), 3) # Indranil Ghosh, Jun 06 2017
A004481
Table of Sprague-Grundy values for Wythoff's game (Wyt Queens) read by antidiagonals.
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, 2, 2, 4, 7, 7, 8, 8, 8, 0, 7, 0, 8, 8, 8, 9, 6, 6, 1, 6, 6, 1, 6, 6, 9, 10, 10, 7, 9, 9, 8, 9, 9, 7, 10, 10, 11, 11, 11, 10, 0, 10, 10, 0, 10, 11, 11, 11, 12, 9, 9, 12, 1, 1, 3, 1, 1, 12, 9, 9, 12
Offset: 0
Table begins
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ...
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, 2, 0, 1, 9, 10, 12, ...
4, 5, 3, 2, 7, 6, 9, 0, 1, ...
5, 3, 4, 0, 6, 8, 10, 1, ...
6, 7, 8, 1, 9, 10, 3, ...
7, 8, 6, 9, 0, 1, ...
8, 6, 7, 10, 1, ...
9, 10, 11, 12, ...
10, 11, 9, ...
11, 9, ...
12, ...
...
- E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 76.
- 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?
- R. K. Guy, The unity of combinatorics, Proc. 25th Iranian Math. Conf, Tehran, (1994), Math. Appl 329 129-159, Kluwer Dordrecht 1995, Math. Rev. 96k:05001.
- Vincenzo Librandi, Table of n, a(n) for n = 0..5049
- Uri Blass and Aviezri S. Fraenkel, The Sprague-Grundy function for Wythoff's game, Theoretical Computer Science 75.3 (1990): 311-333. See Table 2.
- F. Michel Dekking, Jeffrey Shallit, and N. J. A. Sloane, Queens in exile: non-attacking queens on infinite chess boards, Electronic J. Combin., 27:1 (2020), #P1.52.
- A. Dress, A. Flammenkamp and N. Pink, Additive periodicity of the Sprague-Grundy function of certain Nim games, Adv. Appl. Math., 22, p. 249-270 (1999).
- Gabriel Nivasch, More on the Sprague-Grundy function for Wythoff's game, pages 377-410 in "Games of No Chance 3", MSRI Publications Volume 56, 2009. See Table 1.
- Rémy Sigrist, Colored representation of T(x,y) for x = 0..999 and y = 0..999 (where the hue is function of T(x,y) and black pixels correspond to zeros)
- Rémy Sigrist, PARI program for A004481
See
A317205 for triangle of values on or below main diagonal.
Similar to but different from
A004489.
-
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}];
Flatten@Table[t[n - m + 1, m], {n, 11}, {m, n}] (* Birkas Gyorgy, Apr 19 2011 *)
-
See Links section.
Original entry on oeis.org
4, 5, 3, 7, 8, 6, 1, 2, 0, 13, 14, 12, 16, 17, 15, 10, 11, 9, 22, 23, 21, 25, 26, 24, 19, 20, 18, 31, 32, 30, 34, 35, 33, 28, 29, 27, 40, 41, 39, 43, 44, 42, 37, 38, 36, 49, 50, 48, 52, 53, 51, 46, 47, 45, 58, 59, 57, 61
Offset: 0
- Index entries for linear recurrences with constant coefficients, signature (1,0,0,0,0,0,0,0,1,-1).
-
LinearRecurrence[{1, 0, 0, 0, 0, 0, 0, 0, 1, -1}, {4, 5, 3, 7, 8, 6, 1, 2, 0, 13, 14}, 80] (* Jinyuan Wang, Mar 10 2020 *)
-
my(table=[4,4,1,4,4,1,-5,-5,-8]); a(n) = n + table[n%9+1]; \\ Kevin Ryde, Apr 05 2021
-
def tersum(a, b):
c, pow3 = 0, 1
while a + b > 0:
a, ra = divmod(a, 3)
b, rb = divmod(b, 3)
c, pow3 = c + pow3*((ra+rb)%3), pow3*3
return c
def a(n): return tersum(n, 4)
print([a(n) for n in range(58)]) # Michael S. Branicky, Apr 05 2021
Original entry on oeis.org
5, 3, 4, 8, 6, 7, 2, 0, 1, 14, 12, 13, 17, 15, 16, 11, 9, 10, 23, 21, 22, 26, 24, 25, 20, 18, 19, 32, 30, 31, 35, 33, 34, 29, 27, 28, 41, 39, 40, 44, 42, 43, 38, 36, 37, 50, 48, 49, 53, 51, 52, 47, 45, 46, 59, 57, 58, 62, 60, 61, 56, 54, 55, 68, 66, 67, 71, 69
Offset: 0
- Index entries for linear recurrences with constant coefficients, signature (1,0,0,0,0,0,0,0,1,-1).
-
LinearRecurrence[{1, 0, 0, 0, 0, 0, 0, 0, 1, -1}, {5, 3, 4, 8, 6, 7,
2, 0, 1, 14}, 80] (* Jinyuan Wang, Mar 10 2020 *)
-
# T(n, m) in A004489
def a(n): return T(n, 5)
print([a(n) for n in range(68)]) # Michael S. Branicky, May 03 2021
A059249
Tersum n + (n-1); write n and n-1 in base 3 and add mod 3 with no carries.
Original entry on oeis.org
1, 0, 5, 7, 6, 2, 4, 3, 17, 19, 18, 23, 25, 24, 20, 22, 21, 8, 10, 9, 14, 16, 15, 11, 13, 12, 53, 55, 54, 59, 61, 60, 56, 58, 57, 71, 73, 72, 77, 79, 78, 74, 76, 75, 62, 64, 63, 68, 70, 69, 65, 67, 66, 26, 28, 27, 32, 34, 33, 29, 31, 30, 44, 46, 45, 50, 52, 51, 47, 49, 48, 35
Offset: 1
a(21)=14 since 21 and 20 are written in base 3 as 210 and 202 and so their tersum is 112 in base 3, i.e. 9+3+2=14.
A343836
Array T(n, k), n, k > 0, read by antidiagonals; the balanced ternary representation of T(n, k) is obtained by adding componentwise (i.e., without carries) the digits in the balanced ternary representations of n and of k.
Original entry on oeis.org
0, 1, 1, 2, -1, 2, 3, 3, 3, 3, 4, 4, -2, 4, 4, 5, 2, -4, -4, 2, 5, 6, 6, -3, -3, -3, 6, 6, 7, 7, 10, -2, -2, 10, 7, 7, 8, 5, 8, 8, -4, 8, 8, 5, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 13, 10, 10, -5, 10, 10, 13, 10, 10, 11, 8, 11, 11, 8, -7, -7, 8, 11, 11, 8, 11
Offset: 0
Array T(n, k) begins:
n\k| 0 1 2 3 4 5 6 7 8 9 10 11 12 13
---+-----------------------------------------------------------------
0| 0 1 2 3 4 5 6 7 8 9 10 11 12 13
1| 1 -1 3 4 2 6 7 5 9 10 8 12 13 11
2| 2 3 -2 -4 -3 10 8 9 13 11 12 7 5 6
3| 3 4 -4 -3 -2 8 9 10 11 12 13 5 6 7
4| 4 2 -3 -2 -4 9 10 8 12 13 11 6 7 5
5| 5 6 10 8 9 -5 -7 -6 -11 -13 -12 -8 -10 -9
6| 6 7 8 9 10 -7 -6 -5 -13 -12 -11 -10 -9 -8
7| 7 5 9 10 8 -6 -5 -7 -12 -11 -13 -9 -8 -10
8| 8 9 13 11 12 -11 -13 -12 -8 -10 -9 -5 -7 -6
9| 9 10 11 12 13 -13 -12 -11 -10 -9 -8 -7 -6 -5
10| 10 8 12 13 11 -12 -11 -13 -9 -8 -10 -6 -5 -7
11| 11 12 7 5 6 -8 -10 -9 -5 -7 -6 -11 -13 -12
12| 12 13 5 6 7 -10 -9 -8 -7 -6 -5 -13 -12 -11
13| 13 11 6 7 5 -9 -8 -10 -6 -5 -7 -12 -11 -13
Array T(n, k) begins in balanced ternary:
n\k| 0 1 1T 10 11 1TT 1T0 1T1 10T 100 101 11T 110 111
---+----------------------------------------------------------------------
0| 0 1 1T 10 11 1TT 1T0 1T1 10T 100 101 11T 110 111
1| 1 T 10 11 1T 1T0 1T1 1TT 100 101 10T 110 111 11T
1T| 1T 10 T1 TT T0 101 10T 100 111 11T 110 1T1 1TT 1T0
10| 10 11 TT T0 T1 10T 100 101 11T 110 111 1TT 1T0 1T1
11| 11 1T T0 T1 TT 100 101 10T 110 111 11T 1T0 1T1 1TT
1TT| 1TT 1T0 101 10T 100 T11 T1T T10 TT1 TTT TT0 T01 T0T T00
1T0| 1T0 1T1 10T 100 101 T1T T10 T11 TTT TT0 TT1 T0T T00 T01
1T1| 1T1 1TT 100 101 10T T10 T11 T1T TT0 TT1 TTT T00 T01 T0T
10T| 10T 100 111 11T 110 TT1 TTT TT0 T01 T0T T00 T11 T1T T10
100| 100 101 11T 110 111 TTT TT0 TT1 T0T T00 T01 T1T T10 T11
101| 101 10T 110 111 11T TT0 TT1 TTT T00 T01 T0T T10 T11 T1T
11T| 11T 110 1T1 1TT 1T0 T01 T0T T00 T11 T1T T10 TT1 TTT TT0
110| 110 111 1TT 1T0 1T1 T0T T00 T01 T1T T10 T11 TTT TT0 TT1
111| 111 11T 1T0 1T1 1TT T00 T01 T0T T10 T11 T1T TT0 TT1 TTT
-
T(n,k,c=v->centerlift(Mod(v,3))) = { if (n==0 && k==0, return (0), my (d=c(n), t=c(k)); c(d+t)+3*T((n-d)/3, (k-t)/3)) }
A004500
Tersum n + 11.
Original entry on oeis.org
11, 9, 10, 14, 12, 13, 17, 15, 16, 20, 18, 19, 23, 21, 22, 26, 24, 25, 2, 0, 1, 5, 3, 4, 8, 6, 7, 38, 36, 37, 41, 39, 40, 44, 42, 43, 47, 45, 46, 50, 48, 49, 53, 51, 52, 29, 27, 28, 32, 30, 31, 35, 33, 34, 65, 63, 64, 68, 66, 67, 71, 69, 70, 74, 72, 73, 77, 75
Offset: 0
- Index entries for linear recurrences with constant coefficients, signature (1,0,1,-1,0,0,0,0,-1,1,0,1,-1,0,0,0,0,-1,1,0,1,-1).
-
def a(n):
k, pow3, m = 0, 1, 11
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([a(n) for n in range(58)]) # Michael S. Branicky, Nov 09 2021
A004501
Tersum n + 12.
Original entry on oeis.org
12, 13, 14, 15, 16, 17, 9, 10, 11, 21, 22, 23, 24, 25, 26, 18, 19, 20, 3, 4, 5, 6, 7, 8, 0, 1, 2, 39, 40, 41, 42, 43, 44, 36, 37, 38, 48, 49, 50, 51, 52, 53, 45, 46, 47, 30, 31, 32, 33, 34, 35, 27, 28, 29, 66, 67, 68, 69
Offset: 0
A004502
Tersum n + 13.
Original entry on oeis.org
13, 14, 12, 16, 17, 15, 10, 11, 9, 22, 23, 21, 25, 26, 24, 19, 20, 18, 4, 5, 3, 7, 8, 6, 1, 2, 0, 40, 41, 39, 43, 44, 42, 37, 38, 36, 49, 50, 48, 52, 53, 51, 46, 47, 45, 31, 32, 30, 34, 35, 33, 28, 29, 27, 67, 68, 66, 70
Offset: 0
Showing 1-9 of 9 results.
Comments