Narayana-Zidek-Capell numbers
Ruby, 34 32 bytes
This uses a formula from the OEIS page for the Narayana-Zidek-Cappell numbers.
Edit: Got rid of parentheses using operator precedence with thanks to feersum and Neil.
f=->x{x<4?1:2*f[x-1]-x%2*f[x/2]}
Jelly, 11 10 bytes
HĊrµṖ߀Sȯ1
Try it online!
Takes n
as argument and prints the result.
Explanation
H divide input by 2
Ċ round up to get first n to recurse
r inclusive range from that to n
µ (chain separator)
Ṗ remove n itself from the range
߀ call self recursively on each value in the range
S sum results
ȯ1 if sum was zero, return one
Python 2, 48 42 38 36 bytes
Algorithm taken from the OEIS page. n<3
may be changed to n<4
with no effect. Returns the n
th number, where n
is a positive integer.
a=lambda n:n<3or 2*a(n-1)-n%2*a(n/2)
Try it online