Skip navigation

The Logical Puzzle - 22 Jun 2006

Solution to June's Puzzle: Remainders

In last month's puzzle (submitted by Gabriel Ben-Gan), I asked you to find the smallest integer (n) that would yield a remainder of i-1 when divided by i, for any i in the range 2 through 10. That is, n % 2 = 1, n % 3 = 2, n % 4 = 3, ..., n% 9 = 8, n % 10 = 9, in which the percent sign (%) signifies a T-SQL modulo operator.

When solving such a problem, try first to relax the limitations and simplify the problem.Then, add complexity layers. For example, first ignore the requirement to find the minimum integer n that qualifies. Try to find a solution for any integer n that would yield the remainder i-1 for any i value. Obviously, if you multiply all i values (2 × 3 × 4 × 5 × 6 × 7 × 8 × 9 ×10) and subtract 1, the result will meet the puzzle's requirement (except for the requirement to find the minimum n).You can express the same result as the product of the prime factors of the various i values: (2 × 3 × \[2 × 2\] × 5 × \[2 × 3\] × 7 × \[2 × 2 × 2\] × \[3 × 3\] × \[2 × 5\]) - 1. Next, tackle the minimum requirement. Of course, you'll have to keep at least one occurrence of each prime number (2, 3, 5, 7). The distinct prime factors already cover the i values: 2, 3, 6, 5, 7, and 10.You'll need to add occurrences of some of the prime numbers to also cover 4, 8, and 9. It's sufficient to have three occurrences of 2 to get 4 and 8, and it's also sufficient to keep two occurrences of 3 to get 9. So, the minimum integer n that qualifies can be expressed as: 2 × 2 × 2 × 3 × 3 × 5 × 7 - 1 = 2519.

July's Puzzle: Hiking a Mountain

Special thanks to my father, Gabriel Ben-Gan, for this month's puzzle. A hiker walks up a mountain, starting at the bottom exactly at sunrise and reaching the top exactly at sunset.The next day, the hiker walks down the mountain, starting at the top exactly at sunrise and reaching the bottom exactly at sunset, using the same path he used the previous day.Assume that sunrise and sunset occurred at the same time both days. Can you prove that the hiker visited a certain point along the path at the same time of day on both days?

TAGS: SQL
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish