MathDB
SAMO Problem 6: Repeatedly substract ceiling of square root until 0 is obtained

Source: South African Mathematics Olympiad 2020, Problem 6

January 17, 2021
combinatorics

Problem Statement

Marjorie is the drum major of the world's largest marching band, with more than one million members. She would like the band members to stand in a square formation. To this end, she determines the smallest integer nn such that the band would fit in an n×nn \times n square, and lets the members form rows of nn people. However, she is dissatisfied with the result, since some empty positions remain. Therefore, she tells the entire first row of nn members to go home and repeats the process with the remaining members. Her aim is to continue it until the band forms a perfect square, but as it happens, she does not succeed until the last members are sent home. Determine the smallest possible number of members in this marching band.