Let S = {(m,n) : m,n ∈ {1,2,3,…,50}}. If the number of elements (m,n) in S such that 6ᵐ + 9ⁿ is a multiple of 5 is p and the number of elements (m,n) in S such that m+n is a square of a prime number is q, then p+q is equal to

Let S = {(m,n) : m,n ∈ {1,2,3,…,50}}. If the number of elements (m,n) in S such that 6ᵐ + 9ⁿ is a multiple of 5 is p and the number of elements (m,n) in S such that m+n is a square of a prime number is q, then p+q is equal to
🔢
JEE Main · Numerical Answer · Number Theory + Combinatorics
Numerical Answer · Mathematics · Number Theory
Q. Let $$S = \{(m,n) : m,\, n \in \{1,2,3,\ldots,50\}\}$$ If the number of elements $(m,n)$ in $S$ such that $6^m + 9^n$ is a multiple of $5$ is $p$ and the number of elements $(m,n)$ in $S$ such that $m + n$ is a square of a prime number is $q$, then $p + q$ is equal to _____ .
✅ Correct Numerical Answer
1333
Part 1 — Finding p  ($6^m + 9^n$ divisible by 5)
1
Find $6^m \pmod{5}$ $6 \equiv 1 \pmod{5}$, so:
$6^m \equiv 1^m \equiv 1 \pmod{5}$   for all $m \geq 1$
2
Find $9^n \pmod{5}$ — cyclicity $9 \equiv 4 \pmod{5}$:
$n$$9^n \pmod 5$$n$ parity
14Odd
2$4^2=16\equiv 1$Even
3$4^3\equiv 4$Odd
4$4^4\equiv 1$Even
Period = 2:   $9^n \equiv 4$ if $n$ odd,   $9^n \equiv 1$ if $n$ even
3
Condition for $5 \mid 6^m + 9^n$
$6^m + 9^n \equiv 1 + 9^n \equiv 0 \pmod{5}$

$\Rightarrow 9^n \equiv 4 \pmod{5}$

$\Rightarrow n$ must be odd
4
Count valid pairs
• $m$ can be any of $\{1,\ldots,50\}$:   50 choices
• $n$ must be odd in $\{1,3,5,\ldots,49\}$:   25 choices
$p = 50 \times 25 = \mathbf{1250}$
Part 2 — Finding q  ($m+n$ = square of a prime)
5
Range of $m + n$ Since $m, n \in \{1,\ldots,50\}$:   $m+n \in [2,\, 100]$
6
Find prime squares in $[2, 100]$ Primes $p$ with $p^2 \leq 100$:   $p \in \{2, 3, 5, 7\}$
$2^2 = 4, \quad 3^2 = 9, \quad 5^2 = 25, \quad 7^2 = 49$
$(11^2 = 121 > 100$ — excluded$)$
7
Count pairs for each target sum For $m+n = k$ with $m,n \in \{1,\ldots,50\}$: number of pairs $= k-1$ (for $k \leq 51$):
$m+n$PrimeValid pairs $(m,n)$Count
42(1,3),(2,2),(3,1)3
93(1,8),(2,7),…,(8,1)8
255(1,24),(2,23),…,(24,1)24
497(1,48),(2,47),…,(48,1)48
$q = 3 + 8 + 24 + 48 = \mathbf{83}$
8
Final Answer: $p + q$
$p + q = 1250 + 83 = $ $\mathbf{1333}$
Related Theory
📌 Modular Arithmetic — Cyclicity of Powers
When finding $a^n \pmod{m}$, the remainders repeat in a cycle (cyclicity). Key results:
• $6^m \equiv 1^m = 1 \pmod 5$ (since $6 = 5+1$)
• $9^n \pmod 5$: cycle length 2 (alternates 4, 1, 4, 1, …)

$a \equiv r \pmod m \Rightarrow a^n \equiv r^n \pmod m$ Cyclicity of $4^n \pmod 5$: period 2
📌 Counting Ordered Pairs with Fixed Sum
For $m+n = k$ with $m,n \in \{1,\ldots,N\}$:
• If $k \leq N+1$: number of pairs $= k-1$
• If $k > N+1$: number of pairs $= 2N+1-k$

For this problem $N=50$, all target sums (4, 9, 25, 49) are $\leq 51$, so count $= k-1$ in each case.
$m+n=k$, $1\leq m,n\leq 50$: pairs $= \min(k-1,\, 101-k)$
📌 Prime Squares in a Range
Always list primes systematically: 2, 3, 5, 7, 11, 13, …
Check $p^2 \leq$ upper limit. Here upper limit = 100:
$2^2=4 ✓$, $3^2=9 ✓$, $5^2=25 ✓$, $7^2=49 ✓$, $11^2=121 ✗$

Common mistake: forgetting $11^2=121 > 100$ is excluded, or missing that $m+n$ can be at most 100.
📌 Common Mistakes to Avoid
❌ Mistake 1: Using $9^n \equiv 4$ for all $n$ — it alternates. Even $n$ gives $9^n \equiv 1$, not 4.

❌ Mistake 2: Counting $n=0$ as a valid choice — here $n \in \{1,\ldots,50\}$, so $n=0$ is not allowed.

❌ Mistake 3: Including $11^2=121$ as a valid sum — maximum possible sum is $50+50=100$.

❌ Mistake 4: For $m+n=4$: counting (0,4),(4,0) — these are invalid since $m,n \geq 1$.
📌 Key Formulas
$6^m \equiv 1 \pmod 5$ always $9^n \pmod 5$: period 2 Odd $n$: $9^n\equiv 4$; Even $n$: $9^n\equiv 1$ Pairs with sum $k$ ($k\leq N+1$): $k-1$ Primes squared $\leq 100$: 4,9,25,49
📌 JEE Relevance
This two-part NAT question tests modular arithmetic and combinatorial counting — both core JEE topics. The key skills are: cyclicity of remainders, and systematic counting of ordered pairs with a given sum. 74% users got it wrong, primarily by errors in the cyclicity pattern of $9^n \pmod 5$ or by missing a prime square. Practice modular cyclicity problems daily for guaranteed marks.
JN
JEE NEET Experts Editorial Team 10+ Years Experience · JEE & NEET Mathematics Specialist
Expert in Number Theory, Combinatorics & Algebra
Frequently Asked Questions
1. What is $6^m \pmod 5$?
$6 \equiv 1 \pmod 5$, so $6^m \equiv 1$ for all $m \geq 1$.
2. What is the cyclicity of $9^n \pmod 5$?
Period 2: $9^n \equiv 4$ when $n$ is odd, $9^n \equiv 1$ when $n$ is even.
3. When is $6^m + 9^n \equiv 0 \pmod 5$?
When $9^n \equiv 4 \pmod 5$, i.e., when $n$ is odd.
4. How many odd values does $n$ take in $\{1,\ldots,50\}$?
25 odd values: $1,3,5,\ldots,49$.
5. What is $p$?
$p = 50 \times 25 = 1250$.
6. What prime squares lie in range $[2,100]$?
$4, 9, 25, 49$ (from primes 2, 3, 5, 7).
7. How many pairs give $m+n=25$?
$25-1 = 24$ pairs: $(1,24),(2,23),\ldots,(24,1)$.
8. What is $q$?
$q = 3 + 8 + 24 + 48 = 83$.
9. What is $p + q$?
$p + q = 1250 + 83 = 1333$.
10. Why is $11^2 = 121$ excluded?
Maximum $m+n = 50+50 = 100 < 121$, so no pair can give sum 121.
11. Is 1 considered a prime number here?
No. 1 is not a prime number. The smallest prime is 2.

Related Covered Topics

jee mains jee advanced iit jee number theory jee modular arithmetic cyclicity of remainders combinatorics jee ordered pairs counting prime numbers prime squares numerical answer type jee important jee mains question engineering entrance exam algebra jee set theory jee
Scroll to Top