login
A371998
a(n) = A000166(floor(n/2)) if n is even otherwise A000240(floor((n + 1)/2)).
1
1, 1, 0, 0, 1, 3, 2, 8, 9, 45, 44, 264, 265, 1855, 1854, 14832, 14833, 133497, 133496, 1334960, 1334961, 14684571, 14684570, 176214840, 176214841, 2290792933, 2290792932, 32071101048, 32071101049, 481066515735, 481066515734, 7697064251744, 7697064251745
OFFSET
0,6
MAPLE
a := n -> if irem(n, 2) = 0 then A000166(iquo(n, 2)) else A000240(iquo(n+1, 2)) fi:
seq(a(n), n = 0..32);
PROG
(Python)
from functools import cache
@cache
def sf(n):
if n == 0: return 1
return n * sf(n - 1) + (-1 if n % 2 else 1)
def a(n):
h, r = divmod(n, 2)
return sf(h) * (h + 1) if r else sf(h)
print([a(n) for n in range(33)])
CROSSREFS
Sequence in context: A274181 A195055 A214683 * A363816 A060921 A163356
KEYWORD
nonn
AUTHOR
Peter Luschny, Apr 25 2024
STATUS
approved