# 2010 AMC 10A Problems/Problem 25

## Problem

Jim starts with a positive integer and creates a sequence of numbers. Each successive number is obtained by subtracting the largest possible integer square less than or equal to the current number until zero is reached. For example, if Jim starts with , then his sequence contains numbers:

Let be the smallest number for which Jim’s sequence has numbers. What is the units digit of ?

## Solution

We can find the answer by working backwards. We begin with on the bottom row, then the goes to the right of the equal's sign in the row above. We find the smallest value for which and , which is .

We repeat the same procedure except with for the next row and for the row after that. However, at the fourth row, we see that solving yields , in which case it would be incorrect since is not the greatest perfect square less than or equal to . So we make it a and solve . We continue on using this same method where we increase the perfect square until can be made bigger than it. When we repeat this until we have rows, we get:

Hence the solution is the last digit of , which is .