All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 4b4N & after (Posted on 2013-07-17)
Let N be a non-zero natural number composed of n digits.
Let us then both prepend and append the number 4 to create two new numbers, 4N and N4, that are both (n+1) digits long.
For example, if N is 123, then we create two numbers: 4123 and 1234.
The question is to find the smallest value of N, such that the following equation holds true:
4N = 4*N4
Again, using the example above, this would require that 4123 = 4*1234.
This is obviously not true, so N=123 is not a solution.

So, find the smallest value of N and its length n.

Bonus:
A generalized question: For which values of K can we find a value
of N (of length n) that solves the general equation KN = K*NK, as defined above?

source: March issue of Science 2.0

Comments: ( Back to comment list | You must be logged in to post comments.)
 Bonus (spoiler) | Comment 2 of 3 |
The problem requires that K*10^n + N = K*(10N + K)

Rearranging gives
K*10^n - K^2 = N(10*K - 1)

So there is a solution only if there exists an n such that
K*(10^n - K) is divisible by (10*K - 1).

But K is relatively prime to 10K - 1, so there is a solution only if there exists an n such that (10^n - K) is divisible by (10*K - 1).

At first blush, I would have expected this to work whenever
(10*K - 1) is prime, and sometimes when it is composite, but instead it appears to work for all K.  The minimum n is 1 less than the cycle length of 10^a mod (10*K - 1).

This is the case because 10^0 mod (10*K - 1) = 1.
If the cycle length is b, then 10^b mod (10*K - 1) = 1, (it has cycled back).
But then 10^(b-1) mod (10*K - 1) = K,
so (10^(b-1) - K) mod (10*K - 1) = 0

p.s. -- For example, let K = 4.  10^a mod 39 has a cycle length of 6, so the minimum n for the main (non-bonus) problem is 5.  Other n's that work are 11,17,23,29,35, etc.

Edited on July 18, 2013, 9:29 am
 Posted by Steve Herman on 2013-07-18 09:23:07

 Search: Search body:
Forums (0)