28
$\begingroup$

My car has a four digit number with no leading zeros, and the following properties:

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?

$\endgroup$
7
  • 1
    $\begingroup$ It would be clearer if it didn't use "..two digits" two different ways... $\endgroup$
    – DJohnM
    Commented Jan 22, 2016 at 5:21
  • 2
    $\begingroup$ 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. $\endgroup$ Commented Jan 22, 2016 at 10:27
  • 5
    $\begingroup$ What's a "car number"? Why does your car have a number? $\endgroup$ Commented Jan 22, 2016 at 20:51
  • $\begingroup$ 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! $\endgroup$ Commented Jan 23, 2016 at 7:16
  • 1
    $\begingroup$ 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"? $\endgroup$
    – Jay
    Commented Jan 25, 2016 at 14:56

11 Answers 11

16
$\begingroup$

Answer should be

4998

Script I used :

# RUBY
for i in 0..9999

  j = i.to_s.rjust(4, "0") # 0 padding
  a = j[0]
  b = j[1]
  c = j[2]
  d = j[3]

  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
$\endgroup$
1
  • 1
    $\begingroup$ Yes... you are correct.. $\endgroup$ Commented Jan 21, 2016 at 10:26
83
$\begingroup$

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 answer

4998

$\endgroup$
6
  • 1
    $\begingroup$ i guess i took too long to write the explanation down, but i just didn't want to post it without explanation $\endgroup$ Commented Jan 21, 2016 at 10:41
  • 3
    $\begingroup$ Welcome to Puzzling.SE! This is a great first answer c: $\endgroup$
    – Deusovi
    Commented Jan 21, 2016 at 18:17
  • 2
    $\begingroup$ 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...) $\endgroup$
    – Hunter
    Commented Jan 22, 2016 at 10:01
  • 1
    $\begingroup$ I agree this is a very good answer, I particulary liked the second reasoning! ... +1 from me $\endgroup$
    – Thrax
    Commented Jan 22, 2016 at 10:59
  • 1
    $\begingroup$ 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. $\endgroup$
    – justhalf
    Commented Jan 25, 2016 at 4:42
33
$\begingroup$

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.

$\endgroup$
2
  • $\begingroup$ 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). $\endgroup$
    – Voo
    Commented Jan 22, 2016 at 18:12
  • 2
    $\begingroup$ 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$. $\endgroup$ Commented Jan 22, 2016 at 18:19
12
$\begingroup$

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

$\endgroup$
3
  • $\begingroup$ Yes correct ... $\endgroup$ Commented Jan 21, 2016 at 10:26
  • 2
    $\begingroup$ Could you share your old way method? That is most of the fun of seeing the solutions here. $\endgroup$ Commented Jan 21, 2016 at 17:49
  • $\begingroup$ 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. $\endgroup$
    – Jay
    Commented Jan 25, 2016 at 15:02
4
$\begingroup$

well...

0 0 0 0

Seems to fit :)

$\endgroup$
5
  • $\begingroup$ No....no vehicles have this number... $\endgroup$ Commented Jan 21, 2016 at 10:07
  • 1
    $\begingroup$ well you didn't specify that to be fair, and it fulfils every criteria :) $\endgroup$ Commented Jan 21, 2016 at 10:08
  • $\begingroup$ I mention My car has four digit number. Means a valid number.. However I will edit my answer. Sorry for misunderstanding.. $\endgroup$ Commented Jan 21, 2016 at 10:15
  • 1
    $\begingroup$ @next2u You mean you'll edit your question. $\endgroup$
    – Alfie
    Commented Jan 21, 2016 at 18:50
  • 1
    $\begingroup$ 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") $\endgroup$
    – Edd
    Commented Jan 22, 2016 at 9:40
3
$\begingroup$

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

$\endgroup$
1
$\begingroup$

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]

$\endgroup$
1
  • 1
    $\begingroup$ 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'. $\endgroup$ Commented Jan 22, 2016 at 9:52
1
$\begingroup$

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.

$\endgroup$
12
  • 1
    $\begingroup$ " then the first two digits must differ by 5" - while true, this is not readily apparent, and deserves some explanation. $\endgroup$ Commented Jan 22, 2016 at 16:03
  • $\begingroup$ @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. $\endgroup$
    – Neil
    Commented Jan 22, 2016 at 17:20
  • $\begingroup$ "Doubling the digits must result in a difference that is a multiple of 10". DIfference between what? And why must it be 10? $\endgroup$ Commented Jan 22, 2016 at 17:45
  • $\begingroup$ Difference between the first two digits as you originally asked, and because we're working in base 10. $\endgroup$
    – Neil
    Commented Jan 22, 2016 at 19:38
  • $\begingroup$ 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. $\endgroup$ Commented Jan 22, 2016 at 19:57
1
$\begingroup$

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

$\endgroup$
1
  • $\begingroup$ A bit late mate... $\endgroup$
    – Daedric
    Commented Jan 23, 2016 at 12:58
1
$\begingroup$

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))
   .head

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

$\endgroup$
1
  • $\begingroup$ 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: $\endgroup$
    – Deusovi
    Commented Jan 24, 2016 at 2:13
0
$\begingroup$

Wolfram Mathematica solution:

Wolfram Mathematica solution

The answer should be:

4998

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.