4 ms·
That doesn't work when both are odd. For example, for x=1 and y=3 this gives 1 instead of 2.
by adwn 4y ago
That doesn't work when both are odd. For example, for x=1 and y=3 this gives 1 instead of 2.
- someweirdperson 4y ago1/2 + 3/2 + 1 = 0 + 1 + 1 = 2
- rocqua 4y agoYour final +1 is not in the expression by OP. You can get it by taking the correction term (x & y & 1) as mentioned in another comment.
- someweirdperson 4y agowoops, misread the indent-depth of the posts as reply, not to the same parent.