OFFSET
1,3
COMMENTS
The number of V's such that f(U) and f(V) agree in no positions gives the A051292(n+1) sequence (Whitney numbers): 1, 4, 9, 21, 52, 127, 313, 778, 1941, 4863, 12228, 30817, ...
EXAMPLE
For n=1, U = 12 and only one V, 12 is a 1-match, so a(1)=1.
For n=2, U = 1122, f(U) = 11,12,22 and only one V, 2121 is a 1-match, with f(v) = 21,12,21, so a(2)=1.
For n=3, U = 111222 and only the four V's 112212, 121122, 121221 and 221211 are 1-matches, so a(3)=4.
MAPLE
with(combinat): for n from 1 to 10 do y:=0:B:=array: M:=[seq(11, i=1..n-1), seq(12, i=n), seq(22, i=n+1..2*n-1)]: S:=[seq(i, i=1..2*n)]: L:=choose(S, n): for j from 1 to binomial(2*n, n) do for k from 1 to 2*n-1 do if member(k, L[j]) then B[k]:=10 else B[k]:=20 end if: if member(k+1, L[j]) then B[k]:=B[k]+1 else B[k]:=B[k]+2 end if end do: x:=0: for l from 1 to 2*n-1 do if B[l]=M[l] then x:=x+1 end if end do: if x=1 then y:=y+1 end if end do: print(y) end do: # Miklos Kristof, Oct 07 2004
PROG
(Python)
def find(bits_in, n0, n1, match):
....global count, U
....bitsleft = n0 + n1
....if bitsleft==0:
........if match:
............count += 1
....else:
........bitsleft -= 1
........if n0 > 0:
............bits_out = bits_in<<1
............new_match = (bits_out&3) == ((U >> bitsleft)&3)
............if not (match and new_match):
................find(bits_out, n0-1, n1, match or new_match)
........if n1 > 0:
............bits_out = (bits_in<<1)|1;
............new_match = (bits_out&3) == ((U >> bitsleft)&3)
............if not (match and new_match):
................find(bits_out, n0, n1-1, match or new_match)
def A098813(n):
....global count, U
....count = 0 ; U = (1<<n)-1
....find(0, n-1, n, False)
....find(1, n, n-1, False)
....return count
# Bert Dobbelaere, Dec 23 2018
CROSSREFS
KEYWORD
nonn,nice
AUTHOR
Zerinvary Lajos (with help from Miklos Kristof), Oct 07 2004
EXTENSIONS
a(13)-a(15) from Ray Chandler, Oct 25 2004
a(16)-a(28) from Bert Dobbelaere, Dec 24 2018
STATUS
approved