Comment

Comment by periram

Also (n+1)^ = n^2 + 2n +1 i.e. you can have the previous square and just add 2n+1 to it to get the next square (which is 3 additions in total). square += i + i + 1 if square < n; break
parent periram 3 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton