How many positive four-digit integers n have the property that the three-digit number obtained by removing the leftmost digit is one-ninth of n?
How many positive four-digit integers n have the property that the three-digit number obtained by removing the leftmost digit is one-ninth of n?
n=1000a+100b+10c+d where a,b,c and d are all single digit numbers.
n-1000a = n/9
9n-9000a=n
8n=9000a
8000a+800b+80c+8d=9000a
800b+80c+8d=1000a
100b+10c+d=125a
If a=1
100b+10c+d=125 so the number is 1125
if a=2
100b+10c+d=250 so the number is 2250
if a=3
100b+10c+d=375 so the number is 3375
if a=4
100b+10c+d=500 so the number is 4500
if a=5
100b+10c+d=625 so the number is 5625
if a=6
100b+10c+d=750 so the number is 6750
if a=7
100b+10c+d=875 so the number is 7875
if a=8
100b+10c+d=1000 so the number is 9000 That is no good
if a=9
100b+10c+d=1125 so the number is 5 digits which is too big.
So there are exactly 7 four digit numbers that meet this description.
Melody: I found only 7 such numbers:
n=1107; m=1;if((n - 1000*m) / n ==1/9, goto3, goto4);printn;n=n+9; if(n<10000, goto2, discard=0;
n = 1125, 2250, 3375, 4500, 5625, 6750, 7875
Yes sorry.
It has just been pointed out to me that I mad a careless error that trivialized the answer. (My wrong answer I mean.)
It should not have been 8, it should have been 8d in the working.
I'll fix that and then I will think about it
My answer is correct now. :)
Thanks guest for the little line of code to work it out.
What language is it coding for?
I must learn some coding one day, it is on my 'to do' list LOL
Also thanks guest for recognising that all these numbers are multiples of 1125
I can see it is logical that this would happen. :)