Riddle #498

logicmathshort

Magic number

Ramanujan discovered 1729 as a magic number. Why 1729 is a magic number ?
It can be expressed as the sum of the cubes of two different sets of numbers. 10^3 + 9^3 = 1729 and 12^3 + 1^3 = 1729
87.96 %
47 votes

Similar riddles

See also best riddles or new riddles.

logicshort

Akbar and Birbal

One day, Emperor Akbar posed a question to Birbal. He asked him what Birbal would choose if he offered either justice or a gold coin. "The gold coin," said Birbal without hesitation. On hearing this, Akbar was taken aback. "You would prefer a gold coin to justice?" he asked, not believing his own ears. "Yes," said Birbal. The other courtiers were amazed by Birbal's display of idiocy. They were full of glee that Birbal had finally managed himself to do what these courtiers had not been able to do for a long time - discredit Birbal in the emperor's eyes! "I would have been disappointed if this was the choice made even by my lowliest of servants," continued the emperor. "But coming from you it's not only disappointing, but shocking and sad. I did not know you were so debased!" How did Birbal justify his answer to the enraged and hurt Emperor?
"One asks for what one does not have, Your Majesty." said Birbal, smiling gently and in quiet tones. "Under Your Majesty´s rule, justice is available to everybody. But I am a spendthrift and always short of money and therefore I said I would choose the gold coin." The answer immensely pleased the emperor and respect for Birbal was once again restored in the emperor's eyes.
93.84 %
41 votes

logicmath

Anagram Checker

Two words are anagrams if and only if they contain the exact same letters with the exact same frequency (for example, "name" and "mean" are anagrams, but "red" and "deer" are not). Given two strings S1 and S2, which each only contain the lowercase letters a through z, write a program to determine if S1 and S2 are anagrams. The program must have a running time of O(n + m), where n and m are the lengths of S1 and S2, respectively, and it must have O(1) (constant) space usage.
First create an array A of length 26, representing the counts of each letter of the alphabet, with each value initialized to 0. Iterate through each character in S1 and add 1 to the corresponding entry in A. Once this iteration is complete, A will contain the counts for the letters in S1. Then, iterate through each character in S2, and subtract 1 from each corresponding entry in A. Now, if the each entry in A is 0, then S1 and S2 are anagrams; otherwise, S1 and S2 aren't anagrams. Here is pseudocode for the procedure that was described: def areAnagrams(S1, S2) A = new Array(26) A.initializeValues(0) for each character in S1 arrayIndex = mapCharacterToNumber(character) //maps "a" to 0, "b" to 1, "c" to 2, etc... A[arrayIndex] += 1 end for each character in S2 arrayIndex = mapCharacterToNumber(character) A[arrayIndex] -= 1 end for (i = 0; i < 26; i++) if A[i] != 0 return false end end return true end
93.70 %
40 votes

logicshort

A boys name

Without looking at a calendar, within a minute name a boys name using 5 consecutive first letters of 5 consecutive months.
JASON - July August September October November.
93.55 %
39 votes

logicmath

Three daughters

Sam has got three daughters. The eldest daughter is the most honest girl in the universe and she always speaks truth. The middle daughter is a modest woman. She speaks truth and lies according to the situations. The youngest one never speaks truth. Not a single word she spoke was true and would never be true. Sam brought a marriage proposal for one of his girls. It was John. John wanted to marry either the eldest or the youngest daughter of Sam as he can easily identify whether the girl speaks truth or lie! John told his desire to Sam. However, Sam laid a condition. He told John that he will not say who the eldest, middle or youngest one is. Also, he allowed john to ask only one question to identify the eldest or youngest so he can marry one. John asked one question and found the right girl. What was the question and whom should he pick? He asks this question to one of the daughters. If he asked this question to older daughter pointing at other two, he probably would know the youngest one! NO matter, she always speaks truth. If he asked the question to middle one, probably he can choose either. If he asked the youngest one, she always lies and he can find eldest one! No matter, he has to choose the youngest one based on the answer.
The question he asked is, ‘Is she older than her!’ He asks this question to one of the daughters. If he asked this question to older daughter pointing at other two, he probably would know the youngest one! NO matter, she always speaks truth. If he asked the question to middle one, probably he can choose either. If he asked the youngest one, she always lies and he can find eldest one. No matter, he has to choose the youngest one based on the answer.
93.39 %
38 votes

logicmath

Maths trick riddle

I know a number which when multiplied by multiple of 9 i.e 9 18 27 36 45 ... The output consist of number containing only one digit. Can you identify the number?
12345679 12345679 × 9 = 111111111 (only 1s) 12345679 × 18 = 222222222 (only 2s) 12345679 × 27 = 333333333 (only 3s) 12345679 × 36 = 444444444 (only 4s) 12345679 × 45 = 555555555 (only 5s)
93.39 %
38 votes

logicmath

The missing dollar

Three people check into a hotel room. The bill is $30 so they each pay $10. After they go to the room, the hotel's cashier realizes that the bill should have only been $25. So he gives $5 to the bellhop and tells him to return the money to the guests. The bellhop notices that $5 can't be split evenly between the three guests, so he keeps $2 for himself and then gives the other $3 to the guests. Now the guests, with their dollars back, have each paid $9 for a total of $27. And the bellhop has pocketed $2. So there is $27 + $2 = $29 accounted for. But the guests originally paid $30. What happened to the other dollar?
This riddle is just an example of misdirection. It is actually nonsensical to add $27 + $2, because the $27 that has been paid includes the $2 the bellhop made. The correct math is to say that the guests paid $27, and the bellhop took $2, which, if given back to the guests, would bring them to their correct payment of $27 - $2 = $25.
93.39 %
38 votes

logicshort

Twin brother

Peter celebrated his birthday on one day, and two days later his older twin brother, Paul, celebrated his birthday. How could this be?
When the mother of the twins went into labour, she was travelling by boat. The older twin, Paul, was born first, barely on March 1st. The boat then crossed a time zone,
93.39 %
38 votes

logicshort

The rarest book in the World

A man had a book that was worth $40,000. There were only 2 books in existence. He threw it in the furnace, reducing it to a pile of soot. Why did he do this?
He destroyed the book because he has two, and by only having one, the value goes up.
93.39 %
38 votes

animallogicmath

Chickens and Rabbits

There are several chickens and rabbits in a cage (with no other types of animals). There are 72 heads and 200 feet inside the cage. How many chickens are there, and how many rabbits?
Let c be the number of chickens, and r be the number of rabbits. r + c = 72 4r + 2c = 200 To solve the equations, we multiply the first by two, then subtract the second. 2r + 2c = 144 2r = 56 r = 28 c = 44 So there are 44 chickens and 28 rabbits in the cage.
93.39 %
38 votes