← All problemsSign in

Difference of 2

A pair of integers is called a twin if: 1. They are both primes. A prime number is an integer greater than 1 that has no positive divisors other 1 than and itself. 2. Their absolute difference is exactly equal to 2. Given an inclusive interval of integers from $n$ to $m$, can you help Param to find the number of pairs of twins that are there in the interval (i.e. [n,m] )? Note that $ (i,j)$ and

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start