1

This is a coding question.Here we have to find the $k$-th value in which we get $888$ as the last three numbers for a cube of a number. For example, if $k=1$ the first value with last three numbers as $888$ is $192 ^3$.Then if $k=2$ the second value with last three numbers as $888$ is $442 ^3$. After checking the solution for the problem they arrived at this formula

  • answer = $192+(k-1)250$.

My question is how did you arrive at this formula and how do you tackle math problems where you need to find n last digits.I know cyclicity is one of the methods but that is used to find the last digit.In this case i have to find the last three digits.

Ian
  • 101,645
navroze
  • 19
  • 5
    Please change your title. It's very unprofessional. – Cameron Williams Sep 02 '15 at 13:54
  • 1
    I changed the title. Not funny. I also changed the tags. IMHO this is not a coding question. You are entitled to disagree about the tags, but I think I know what I was doing :-) – Jyrki Lahtonen Sep 02 '15 at 14:01
  • 1
    Why is it so hard to read descriptions of tags? computer-arithmetic is about floating point decimal arithmetic (and, I guess, fixed point, if that subject ever actually came up)... – Ian Sep 02 '15 at 14:08
  • Sorry i am new ill keep a note of it – navroze Sep 02 '15 at 14:09
  • More helpfully: suppose $n^3$ has remainder $888$ when divided by $1000$. For $(n+k)^3$ to also have remainder $888$ when divided by $1000$, it is necessary and sufficient to have $3n^2k+3nk^2+k^3$ be divisible by $1000$. Now $3n^2$ has remainder $632$ when divided by $1000$, while $3n$ has remainder $664$ when divided by $1000$. So it is necessary and sufficient to have $632k+664k^2+k^3$ be divisible by $1000$. This no longer depends on $n$ at all, so a quick induction argument proves that your solution is an arithmetic progression. – Ian Sep 02 '15 at 14:12
  • (Cont.) So we have reduced the problem to "find the smallest number $n$ such that $n^3$ has remainder $888$ when divided by $1000$ and the smallest number $k$ such that $632k+664k^2+k^3$ is divisible by $1000$." There is probably a way to do this analytically, but you can also just calculate it by brute force. The only thing I've used here is the fact that the "mod 1000" operator distributes over addition and over multiplication. – Ian Sep 02 '15 at 14:13
  • You could write every integer as $1000p+q$ where $q$ is a non-negative integer less than $1000$. Cubing this will result in $1000x+q^3$ for some integer $x$, so you only have to check for all non-negative integers less than $1000$ and then add multiples of $1000$ to them. – skyking Sep 02 '15 at 14:16

1 Answers1

2

HINT:

We need $$c^3\equiv8\pmod{10}$$

$$c\equiv0,1\cdots,9\pmod{10}\implies c^3\equiv0,1,8,7,4,5,6,3,2,9$$

So,$c\equiv2\pmod{10}$

So, the number is of the form $(10b+2)^3\equiv8+20b\pmod{100}$

Now $20b+8\equiv88\pmod{100}\iff b\equiv4\pmod5$

So, the number is of the form $100a+42$ or $100a+(4+5)2$

and so on