# What is my four digit car number?

My car has a four digit number.

Its last digit is double the first digit

its middle two digits are the same

its last two digits are double the first two digits

What is my car's number?

EDIT

The four digit number should be valid. For example

0000 invalid

0xxx invalid

00xx invalid

000x invalid

where x is any number(0 or positive number), left most x not 0 in each case

I think the question is clear...

• It would be clearer if it didn't use "..two digits" two different ways... Jan 22 '16 at 5:21
• I interpreted the "last two digits are double the first two digits" as "the sum of last digits is twice the sum of first two digits", rather than "the number composed of first two digits is double the number composed by the last two digits". It seems like I'm not the only one to do so, so you should probably clarify that in the question. Jan 22 '16 at 10:27
• What's a "car number"? Why does your car have a number? Jan 22 '16 at 20:51
• I interpreted that as "the third digit is double the first digit, and the fourth digit is double the second digit". In which case there are no solutions! Jan 23 '16 at 7:16
• I don't know what a "car number" is, and in any case, it's not clear how this affects the puzzle. Why not just say, "a number"?
– Jay
Jan 25 '16 at 14:56

4998

Script I used :

# RUBY
for i in 0..9999

j = i.to_s.rjust(4, "0") # 0 padding
a = j
b = j
c = j
d = j

if (b != c) then next end # Rule2
if d.to_i != (2 * a.to_i) then  next end #Rule1
if 2 * (a.to_s + b.to_s).to_i != (c.to_s + d.to_s).to_i then next end #Rule3

puts j

next

end

• Yes... you are correct.. Jan 21 '16 at 10:26

Last digit is the double of first digit

1..2
2..4
3..6
4..8

Middle two digits are same it has to be a number when multiplied by 2 has the last digit in it

1662
2774
3886
4998

Last two digits are the double of first two digits The only correct possible awnser

4998

• i guess i took too long to write the explanation down, but i just didn't want to post it without explanation Jan 21 '16 at 10:41
• Welcome to Puzzling.SE! This is a great first answer c:
– Deusovi
Jan 21 '16 at 18:17
• I appreciate the fact that this answers is based on a plain reasoning, instead of the selected answers which uses a script (I know, you must use your brain to create a scripts too... but this answer is IMHO far more creative, and for this reason valuable of being selected as best answer...) Jan 22 '16 at 10:01
• I agree this is a very good answer, I particulary liked the second reasoning! ... +1 from me Jan 22 '16 at 10:59
• Based on you current explanation you missed other four cases after second reasoning where there is no carry when double the middle digits (i.e., 1112, 2224, 3336, 4448). But those will be removed by the third reasoning anyway. Jan 25 '16 at 4:42

A deductive approach:

The number has form abb(2a) for digits a and b. Since the last two digits are double the first two, 10b + 2a = 2(10a + b). So 8b = 18a and 4b = 9a. Therefore b = 9, a = 4, and the solution is 4998.

• The "therefore" follows because b = 18a/8 is an integer iff a is of the form LCM[18,8]*x/8 for all natural x. Of all these options only the first one fulfills the other requirements (well if we assume the natural numbers start at 1). Just to make that part a bit more thorough - good answer though. (I hope that math doesn't count as a spoiler, I removed anything that'd give away the answer for anyone who can't do the least common multiple in their head).
– Voo
Jan 22 '16 at 18:12
• Realistically, anyone wanting to avoid spoilers shouldn't even be reading comments. A simpler explanation: $a \ne 0$ since leading 0s have been disallowed from the solution. $4b = 9a$ requires $b \ne 0$ either. Now $4$ and $9$ are relatively prime. So, since $9$ divides $4b$, it must divide $b$. The only single digit numbers divisible by $9$ are $0$ and $9$. Thus $b = 9$ and $a = 4\times9 / 9 = 4$. Jan 22 '16 at 18:19

I think it's

4 9 9 8

Good math problem! ;)

Done in the old way, not programming took place!

From the clues we have:
a b c d
d = 2*a
b = c
10*c + d = 2*(10*a + b)

Doing some substitution we achieve:

10*b + 2*a = 2*(10*a + b)
8*b = 18*a
4*b = 9*a

So

a has to be a 4
b has to be a 9
cd has to be 49*2 = 98

• Yes correct ... Jan 21 '16 at 10:26
• Could you share your old way method? That is most of the fun of seeing the solutions here. Jan 21 '16 at 17:49
• Yes, that's the way I did it. You might want to clarify that while 4b=9a has an infinite number of solutions if a and b are rational (a=1, b=9/4; a=16, b=36; etc), here we are limited to integers between 1 and 9, and so the only solution is a=4, b=9.
– Jay
Jan 25 '16 at 15:02

well...

0 0 0 0

Seems to fit :)

• No....no vehicles have this number... Jan 21 '16 at 10:07
• well you didn't specify that to be fair, and it fulfils every criteria :) Jan 21 '16 at 10:08
• I mention My car has four digit number. Means a valid number.. However I will edit my answer. Sorry for misunderstanding.. Jan 21 '16 at 10:15
• @next2u You mean you'll edit your question. Jan 21 '16 at 18:50
• The Spanish registration system allows four consecutive zeros, for example: matriculasdelmundo.com/matriculas/SP/LE0000W.jpg (although admittedly this may not be the "car's number")
– Edd
Jan 22 '16 at 9:40

If a is the first digit b is the second and third and d is the last, then

20*a + 2*b = 10*b + d


because its last two digits are double the first two digits. Or, simplifying

20*a = 8*b + d


Because Its last digit is double the first digit, we can rewrite this as

20*a = 8*b + 2*a


Which amounts to

9*a = 4*b


Since the 0 solution is forbidden, and both a and b are naturals less than 10, evidently the answer is

4 9 9 8, where a = 4, b = 9 and d = a*2 = 8

x 0 0 2x where 0<x<4.

• Its last digit is double the first digit [x and 2x, check]

• its middle two digits are the same [0&0, check]

• its last two digits are double the first two digits [x+0 and 0+2x, check]

• As for your answer: There already was a different and accepted answer. While the mistake probably comes from poor wording in the question, the OP was looking for a number abcd were 'cd' = 2x 'ab'. You considered the sum of 'a' and 'b', and compared to 'c' + 'd'. Jan 22 '16 at 9:52

For the last digit to be double the first digit but also the last two digits being double the first two digits then the first two digits must differ by 5, giving (a)(a+5)(a+5)(2a). The restriction on the third digit then requires a+5 = 2a+1 (from the carry from 2(a+5)) which simplifies to a=4.

• " then the first two digits must differ by 5" - while true, this is not readily apparent, and deserves some explanation. Jan 22 '16 at 16:03
• @PaulSinclair Doubling the digits must result in a difference that is a multiple of 10. Because of the limited range of a digit, this can only be 0 or 10. If the difference is zero, then the first two digits are the same, and by extension all four digits are the same, hence zero, hence excluded.
– Neil
Jan 22 '16 at 17:20
• "Doubling the digits must result in a difference that is a multiple of 10". DIfference between what? And why must it be 10? Jan 22 '16 at 17:45
• Difference between the first two digits as you originally asked, and because we're working in base 10.
– Neil
Jan 22 '16 at 19:38
• That makes no sense at all. The difference between the first two digits is at most 9, simply because they are both digits, so it cannot be a multiple of 10. And the question is why "doubling the digits" required this difference to be a multiple of 10. Jan 22 '16 at 19:57

Without looking at any answers, it's:

4998.

Because:

Form the first two clues it's of the form a b b (2a).
So from the last: 20a + 2b = 10b + 2a.
Or: 9a = 4b.
The only single nonzero digits this works for is a = 4 and b = 9

• A bit late mate... Jan 23 '16 at 12:58

A little bit different coding solution: This can be done by creating the cartesian product of four instances of the set of numbers 0-9. This results in a list of our products, each of length 4 (ten thousand such lists, or 104); first is (0, 0, 0, 0), last is (9, 9, 9, 9). Then we filter that list based on the given constraints

In scala:

val toTen = Range.inclusive(0, 9)

val candidates = for { x <- toTen; y <- toTen;
z <- toTen; a <- toTen } yield (x, y, z, a)

val result = candidates.drop(1)   // exclude 0000
.filter(x =>
(x._4 == 2*x._1) && (x._2 == x._3) &&
(x._3*10 + x._4) == 2*(x._1 * 10 + x._2))


res1: (Int, Int, Int, Int) = (4,9,9,8)

• Welcome to Puzzling.SE! Typically we try not to solve "small" puzzles with code, but this is a perfectly acceptable solution. Hope to see you around here more! c:
– Deusovi
Jan 24 '16 at 2:13

Wolfram Mathematica solution: 