Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

A year is peculiar if the sum of the first two digits and the last two digits is equal to the middle two digits. For example, 1978. When was the last peculiar year and is there an algorithm to find any peculiar year?

How would I go about solving this problem? I am completely lost. Any ideas would help.

share|improve this question
6  
for i=0 to 2013; If ... then print ... –  Lord Soth Jul 12 '13 at 20:45
    
@LordSoth are you suggesting to put leading zeros to those years with number of digits less than 4, since you've started from 0? –  Kaster Jul 12 '13 at 20:52
    
@LordSoth: Starting in 1978 seems like a much better idea. Or just going backwards from 2013. –  Chris Eagle Jul 12 '13 at 20:52
    
@MathApprentice I have written the code for you. $1978$ is the last one we saw. Unfortunately we need to wait for another $294$ years (note that we would be dead by then) to see the next one, $2307$. –  Lord Soth Jul 12 '13 at 20:56
4  
Guys, I think all of you are missing one important thing – this is/was a math problem, not a 5-th grade programming problem, so it needs to be solved somehow analytically and somewhat intuitively. As a starter, if $\overline{abcd}$ your number, where $0 < a \le 9,\, 0 \le a,b,c \le 9$ and $a,b,c,d \in \mathbb N$, then the condition might be written as $$ 10a + b + 10c + d = 10b + c $$ So, one might try to solve it using divisibility or whatever. –  Kaster Jul 12 '13 at 21:04
show 1 more comment

1 Answer

up vote 3 down vote accepted

There is no peculiar year in the 21st century, since the middle two digits form a 1 digit number.

In the 20th century, any year is of the form $19xy$. Then the year is peculiar if and only if

$$19+xy=9x \Leftrightarrow 19+10x+y=90+x \Leftrightarrow 9x+y=71 \,.$$

Then since $0 \leq y \leq 9$ we get

$$9x \leq 71 \leq 9x+9 \Rightarrow 62 \leq 9x \leq 71 \Rightarrow x=7 \,.$$

Plugging $x=7$ in $9x+y=71$ we get that $y=8$.

Thus, the only peculiar year in 20's century is 1978.

If the question asks for the peculiar year before 1978, it must be in the 19th century or before:

Repeating:

In the 19th century, any year is of the form $18xy$. Then the year is peculiar if and only if

$$18+xy=8x \Leftrightarrow 18+10x+y=80+x \Leftrightarrow 9x+y=62 \,.$$

Then

$$9x \leq 62 \leq 9x+9 \Rightarrow 53 \leq 9x \leq 62 \Rightarrow x=6 \,.$$

Plugging $x=6$ in $9x+y=62$ we get that $y=8$.

Thus in the 19th century the only peculiar year is $1868$.

P.S. Any peculiar year of the form $1abc$ satisfies

$$10+a+10b+c=10a+b \Rightarrow 9a-9b-c=10$$

This implies that $c \equiv -1 \pmod{9}$ thus $c=8$ and then

$$a-b=2 \,.$$

From here you get easily all the peculiar years between $1000$ and $1999$.

P.P.S. If you are looking for all $4$ digits answers $abcd$ then you need to solve

$$10a+b+10c+d=10b+c \Rightarrow 10a+d= 9(b-c) \,.$$

Then

$$a+d \equiv 0 \pmod 9 \,,$$ and any pair $(a,d)$ which satisfies this relation uniquely determine $b-c$.

So fixing $a$ you get the value(s) of $d$ and from here $b-c$.

share|improve this answer
    
The answer is getting too long, so added this as a comment. The $a+d \equiv 0 \pmod 9$ is pretty obvious if you are familiar with $\pmod 9$ arithmetic: $$a+b+c+d \equiv ab+cd \equiv bc \equiv b+c \pmod 9 $$ –  N. S. Jul 12 '13 at 21:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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