login
a(n) = A000166(floor(n/2)) if n is even otherwise A000240(floor((n + 1)/2)).
1

%I #6 Apr 25 2024 13:23:21

%S 1,1,0,0,1,3,2,8,9,45,44,264,265,1855,1854,14832,14833,133497,133496,

%T 1334960,1334961,14684571,14684570,176214840,176214841,2290792933,

%U 2290792932,32071101048,32071101049,481066515735,481066515734,7697064251744,7697064251745

%N a(n) = A000166(floor(n/2)) if n is even otherwise A000240(floor((n + 1)/2)).

%p a := n -> if irem(n,2) = 0 then A000166(iquo(n,2)) else A000240(iquo(n+1,2)) fi:

%p seq(a(n), n = 0..32);

%o (Python)

%o from functools import cache

%o @cache

%o def sf(n):

%o if n == 0: return 1

%o return n * sf(n - 1) + (-1 if n % 2 else 1)

%o def a(n):

%o h, r = divmod(n, 2)

%o return sf(h) * (h + 1) if r else sf(h)

%o print([a(n) for n in range(33)])

%Y Cf. A000166, A000240.

%K nonn

%O 0,6

%A _Peter Luschny_, Apr 25 2024