Question Help please. Problem = A five digit number with 5 different digits. Place a 2 in front of number to make it a six-digit number.
Multiply the six-digit number by 16. The answer is a seven digit number that begins with the original five-digit number, followed by a 2 and then 0. What is the original five-digit number?
Thanks for help.
Answer I thought about how to do this, and then decided to let the computer figure it out.
I wrote a quick little program in C++ to do this. It is given:
#include <stdio.h>
// Take a five digit number, put a 2 in front, multiply by 16, begins with first five digits
// k is the number xxxxx
// n=(200000+k)
// while (n>9999999) n=n/10
// if n=k, put n
void main() {
long int k; // number used
long int b; // base multiplier
long int r; // result of bk*16
printf ("This program finds a number such that when 200,000 is added to it and\n");
printf ("the number is multiplied by 16, the first five digits of the answer\n");
printf ("are the original number.\n\n");
k = 10000; // k is at least five digits
while (k<=99999) {
r = 16*(200000+k);
if (r/100 == k) printf ("And the numbers are %ld %ld", k, r);
k = k + 1;
}
}
Output: 38095 3809520
The last line is the number and the number n and then 16(200000+n).