For a given , which perfect squares should you try? All where .
Solving gives . So loop from to .
This comes from algebra: isolating the variable in an inequality. Recognizing the sequence structure (perfect squares) guides your loop design.
Loop bounds from sequence
For a given , which perfect squares should you try? All where .
Solving gives . So loop from to .
This comes from algebra: isolating the variable in an inequality. Recognizing the sequence structure (perfect squares) guides your loop design.