Let. If the number of elements in such that is a multiple of is and the number of elements in such that is a square of a prime number is , then is equal to ______.
Solution
Core idea. Reducing the bases modulo five turns each power into a fixed or alternating remainder.
Concept refresher. If , then for every natural , and remainders add: when . The number of ordered pairs of natural numbers with
is when .
Approach. Reduce and modulo to find ; list the squares of primes up to , count the ordered pairs for each, and add.
Step 1: Remainders of the powers
Since and ,
which is when is odd and when is even.
Step 2: Count p
Any works with an odd . There are choices of and odd values of from to :
Step 3: Possible prime squares for q
Since , the sum can be , , or ; the next, , is too large. Each of these is at most , so has ordered pairs:
Step 4: Add
Adding the two counts gives the required value:
Answer. 1333
Sanity check. For the pairs run from to , all inside , which is pairs; and is a multiple of with odd, while is not, with even.
Common wrong answers
- 2583: Taking for every makes always, so and ; but , which is only for odd , so .
- 1330: Leaving out the sum drops its pairs, so and ; is a prime, so counts.
- 1292: Counting unordered pairs gives and ; the elements of are ordered pairs, so and are different, and .
Key takeaway
The trap. Reading nine as four modulo five for every power, which makes every pair work.
How toppers think. They list the few prime squares that fit the range of the sum before counting anything.
Remember. with has ordered solutions when .