logicmathTwo trains are traveling toward each other on the same track, each at 60 miles per hour. When they are exactly 120 miles apart, a fly takes off from the front of one of the trains, flying toward the other train at a constant rate of 100 miles per hour. When the fly reaches the other train, it instantly changes directions and starts flying toward the other train, still at 100 miles per hour. It keeps doing this back and forth until the trains finally collide.
If you add up all the distances back and forth that the fly has travelled, how much total distance has the fly travelled when the trains finally collide?

The fly has travelled exactly 100 miles. We can figure this out using some simple math. Becuase the trains are 120 miles apart when the fly takes off, and are travelling at 60 mph each, they will collide in exactly 1 hour. This gives the fly exactly 1 hour of flying time, going at a speed of 100 miles per hour. Thus, the fly will travel 100 miles in this hour.

## Similar riddles

See also best riddles or new riddles.

logicmathTwo 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

logicmathshortCan you find four consecutive prime numbers that add up to 220?

47 + 53 + 59 + 61 = 220

logicmathSam 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.

logicmathI 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)

logicmathThree 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.

animallogicmathThere 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.

logicmathshortCan you arrange four 9's and use of atmost 2 math symbols, make the total be 100?

99 / .99

logicmathshortWhat is the value of 1/2 of 2/3 of 3/4 of 4/5 of 5/6 of 6/7 of 7/8 of 8/9 of 9/10 of 1000?

100. Looks hard? Don't worry, just work it backwards and you'll find it very easy.

logicmathshortDean Sam and Castiel are three brothers.
Interestingly their current age is prime.
What's more interesting that difference between their ages is also prime.
How old are they?

Sam : 2
Dean : 5
Castiel : 7
Age diff
7 - 2 = '5' is prime
7 - 5 = '2' is prime
5 - 2 = '3' is prime

logicmathshortThe digits 0-9(0,1,2,3,4,5,6,7,8,9) can be rearranged into 3628800 distinct 10 digits numbers.
How many of these numbers are prime?

None. The sum of numbers from 0-9(0,1,2,3,4,5,6,7,8,9) is 45 and therefore can be divisible by 3 and 9.