2023 WSMO Team Round Problems/Problem 8

Problem

Let $f(x)=\sqrt{x-\sqrt{x-\sqrt{x-\ldots}}}.$ Find the modulo 1000 on the minimum integer $a$ such $f(f(f(f(f(a)))))$ is a positive integer.

Solution