A317949 Erroneous version of A013582.
1, 4, 25, 124, 574, 2156, 8258
Offset: 0
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.
a(3) = 7 * (1*7 + 6*(5/2 + 2)) = 238 because 3 discs played in different columns can be transposed in two ways.
The array as given on the Tromp web site: height ------ 8: 9 13343 8424616 1104642469 7: 8 4587 1417322 135385909 14171315454 6: 7 1571 235781 15835683 1044334437 69173028785 4531985219092 5: 6 537 38310 1706255 69763700 2818972642 112829665923 4: 5 179 6000 161029 3945711 94910577 2265792710 54233186631 3: 4 58 869 12031 158911 2087325 27441956 362940958 2: 3 18 116 741 4688 29737 189648 1216721 1: 2 5 13 35 96 267 750 2118 ------------------------------------------------------------------------------- -: 1 2 3 4 5 6 7 <- width
The triangle T(n,k) begins: n/k 4 5 6 7 8 9 10 ... 4: 10 5: 17 28 6: 24 39 54 7: 31 50 69 88 8: 38 61 84 107 130 9: 45 72 99 126 153 180 10: 52 83 114 145 176 207 238 . . .
a(1) = 2: on a 2 X 1 board the first player can insert their first disc in the right or in the left column, the second player has no choice anymore, hence there are two different games. Obviously for the 2 X 1 and 3 X 2 boards, all games will end in a draw.
def next_turn(player): # there are players 0 and 1 global total, position ngames = 0 for i in range(n+1): fill = int(column[i]) # height of column i if fill < n: # throw a disc into column i position = position + 2 ** (i + (n + 1) * fill + ntimesnplus1 * player) # unique identifier for this position if position in games: # half of memory and cpu-time can be saved if you exploit symmetry of positions here ngames = ngames + games[position] else: column[i] = column[i] + 1 total = total + 1 if position in setfinalpos: # we have reached a known final position ngames = ngames + 1 else: # check if the new position is a win or if the board is full if check4win(position, player, fill, i) or total == ntimesnplus1: setfinalpos.add(position) ngames = ngames + 1 else: numbergames = next_turn(1 - player) ngames = ngames + numbergames column[i] = column[i] - 1 total = total - 1 position = position - 2 ** (i + (n + 1) * fill + ntimesnplus1 * player) games[position] = ngames return ngames
Comments