# SPOJ: 1030. Triple Fat Ladies

Pattern Matchers have been designed for various sorts of patterns. Mr. HKP likes to observe patterns in numbers. After completing his extensive research on the squares of numbers, he has moved on to cubes. Now he wants to know all numbers whose cube ends in 888.

Given a number k, help Mr. HKP find the kth number (indexed from 1) whose cube ends in 888.

Solution: Yeah, an other number problem! And again I just looked for patterns.

Which gets us:

EDIT: Thanks to the anonymous person who found a simple connection between the numbers but can’t properly communicate. You can find the k-th number with this simple formula: $192 + 250(k-1)$

You should see that each number ends in 2. If you look closer you see that the last two digits are 42 if i is even, and 92 if i is odd. Let’s look at the other digits. We get:

If you do some basic arithmetics you see that:

You can calculate your first digits either recursively or search for a function. This takes probably some time, so I looked this sequence up. OEIS gives us the formular: a(n) = floor((5n-2)/2) for n > 2

This site uses Akismet to reduce spam. Learn how your comment data is processed.

1. anonymous

are u stupid? cant u see they simply differ by 250.
input n
output 192+250(n-1)

• Arnold Warick

Can’t you see Logic building is also something?