Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library
← Back to context

Comment by skulk

3 months ago

5 is odd, so that's where the 1 comes from

8 ((5*3+1)/2) is even, so that's where the 0 comes from

4 (8/2) is the end.

1 comment

skulk

Reply

lapetitejort  3 months ago

That is correct. I use pseudo-binary to represent the steps the number takes. Simply counting the number of steps is enough to get n, as all steps will have an implicit or explicit even step.

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities