Find The Co-prime
CodeChefOpen on judge ↗
Find the largest non-negative number which is less than or equal to the floor value of (N/2) which is co-prime to N. Two numbers a and b are considered to be co-prime if gcd(a,b)=1. Input First line will be T. Next T lines will be N. Output For each N, print the largest non-negetive number which is less than or equal to the floor value of (N/2) which is co-prime to N. Constraints - 1 ≤ T
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.
Sign in to chat with the tutor and save your progress.
Sign in to start