Welcome to MindCipher, a social repository of the world's greatest brain teasers, logic puzzles and mental challenges.

1978

The year 1978 is such that the sum of the first two digits and the latter two digits is equal to the middle two digits, i.e. 19 + 78 = 97. What is the next year (after 1978) for which this is true?

There are multiple ways to solve the problem, as demonstrated here:

UBS Quant Interview Question

By the way, I am the person (formerly) at UBS who posed this question in an interview in mid-2010, as mentioned in the original post on quantnet; however the question was not to come up with a formula per se to find such years, but rather to say what is the next year without arriving at it merely by brute force. To my knowledge, apart from using brute force, one can solve the problem algebraically or via modular arithmetic, as described in the solutions posted on quantnet. Some people have solved it by simply "seeing" the answer, using neither algebra nor modular arithmetic, as I did in 2009 when I was asked this question during a phone interview and had no pen & paper in hand; one could argue that the "seeing" method is just mental brute force.

Comments


debashish ghatak

2307

take 4 variables a,b,c,d

then your year is 1000a + 100b + 10c +d

and 10a + b + 10c +d = 10b + c => 10a +d = 9(b-c)

now putting 1978 on either sides , you will see tht such an year doesnt exist till 2000. put a = 20 and d such an number tht (10a + d )%9 = 0 d = 7 b=3 , c=0 2307

  

Ryan Miller

Doesn't putting the answer in a comment spoil the fun for those who have not yet solved it? If possible, I would suggest that you delete your comment. Why do you think the Answer and the Solution are hidden by default?


Ravi

+1 to Ryan Miller's comment.


Ravi

Spoiler tags were recently implemented so that you can spoilerhide parts of your comments!


Bogdan Kucherenko

I recommend solving it in your head, at 3am, in a bar, after having a few too many. challenge accepted. ;)

  

Ravi

Well played, good sir.


Rahul Kumar

2307

include<stdio.h>

include<conio.h>

void main() { int y,a,b,c,d,i,j,flag=0,p,q; scanf("%d",&y); while(flag<1 || y<10000)

{
a=y/1000;
b=y/100-a*10;
c=y/10-a*100-b*10;
d=y-a*1000-b*100-c*10;
p=y/100;
q=c*10+d;
//printf("%d %d %d %d",a,b,c,d);
if((p+q)==(b+c))
    {
    printf("%d\n",y);
    flag++;
    }
}

printf("%d %d",y,flag); getch(); }


abc

2307

Check out other puzzles:
Random  

Like this? You might also like:
Cocktail Party
Random Puzzle
Attic Lamp Switch
Submitted by
Ryan Miller
over 1 year ago
Likes
Difficulty 6.0 ?

Tags
Math algebra dates modular arithmetic


Back