f[2 x_] := f[x]
f[1] := 3
f[0] := 0
f[2 x_ + 1] := f[x] + f[x + 1]
a[x_] := f[x]/f[x + 1]
Will this work as an recursive function ? I think there's something wrong with this because every integer will get an output of 3
any help would be appreciated, thank you so much
fn = NestList[1/(1 - # + 2 Floor[#]) &, 0, #] &;
most efficient to generate the first n terms, e.g.fn[1000000]
will generate the result from index 0 to 1000000. $\endgroup$2 x_ + 1
:MatchQ[7, 2 x_ + 1] (* False *)
. An integer is just an integer: it's not structurally equal to an addition. The pattern matcher is not for matching mathematical patterns like these. Only structural ones. Besides, there's nothing in the pattern2 x_ + 1
that even limitsx
to be an integer. $\endgroup$