Inside Microsoft® SQL Server® 2008: T-SQL Querying
by Lubor Kollar Itzik Ben-Gan Dejan Sarka, and Steve Kass
Puzzle Solutions
This section contains solutions to the logic puzzles.
Puzzle 1: Remainders
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 meets 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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access