OFFSET
0,2
COMMENTS
Piles start empty and have no height limit. A token can only be placed on top of a pile. The starting token is fixed.
EXAMPLE
With alternating symbols A and B on three piles (starting with A), the following states emerge after placing 3 symbols in all 3^3 possible ways:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
A A
B B B A A A A A A B B B
A__ AA_ A_A AB_ AB_ ABA A_B AAB A_B BA_ BA_ BAA AA_ _A_ _AA
16 17 18 19 20 21 22 23 24 25 26 27
A
A A A A A A B B B
AAB _AB _AB B_A BAA B_A ABA _BA _BA A_A _AA __A
3 pairs of states (numbered (6,22), (8,16) and (12,20)) are identical, all others are different, hence a(3)=24.
PROG
(Python)
def fill(patterns, state_in, ply_nr, n_plies, n_players, n_stacks):
if ply_nr>=n_plies:
patterns.add(tuple(state_in))
else:
symbol=chr(ord('A')+ply_nr%n_players)
for st in range(n_stacks):
state_out=list(state_in)
state_out[st]+=symbol
fill(patterns, state_out, ply_nr+1, n_plies, n_players, n_stacks)
def A320731(n):
n_plies, n_players, n_stacks = n, 2, 3
patterns=set()
state=[""]*n_stacks
fill(patterns, state, 0, n_plies, n_players, n_stacks)
return len(patterns)
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Bert Dobbelaere, Oct 20 2018
STATUS
approved