Antoine Rimlet <antoine.rimlet@gmail.com> writes:
> Hi list,
>
> I try to get the following little program (a slightly modified "Man or
> boy", it prints -14254067) work "as expected", that is, without consuming
> lots of memory
Are you sure "-14254067" is correct for k=22? Wikipedia [1] and
RosettaCode [2] both seem to suggest that -865 609 is the right
answer. Similarly, for k=10 it is supposed to return -67 rather than -577.
[1] https://en.wikipedia.org/wiki/Man_or_boy_test
[2] http://rosettacode.org/wiki/Man_or_boy_test
--
- Frank