OFFSET
0,2
COMMENTS
If S = {1,2,3,...,2n}, a(n) is the number of functions from S to S such that at least one even number is mapped to an odd number or at least one odd number is mapped to an even number.
Note the result can be obtained as (2*n)^(2*n) - n^(2*n), which is the number of functions from S to S minus the number of functions from S to S that map each even number to an even number and each odd number to an odd number. Hence in particular a(0) = 1-1 = 0.
LINKS
Sidney Cadot, Table of n, a(n) for n = 0..30
EXAMPLE
For n=1, the functions are f1: (1,1),(2,1); f2: (1,2),(2,2); f3: (1,2),(2,1).
MATHEMATICA
a[n_] := If[n == 0, 0, (4^n - 1)*n^(2*n)] (* Sidney Cadot, Jan 05 2023 *)
PROG
(PARI) a(n) = (4^n - 1)*n^(2*n) \\ Charles R Greathouse IV, Oct 03 2022
(Python)
def A356568(n): return ((1<<(m:=n<<1))-1)*n**m # Chai Wah Wu, Nov 18 2022
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Enrique Navarrete, Sep 30 2022
STATUS
approved