A game with primes
CodeChefOpen on judge ↗
Prithvi , An AI machine which likes playing with prime numbers. A prime number is given to prithvi , He has to calculate the primitive numbers of the given prime number. A number X is primitive of a prime number P, if (X^i) mod P generates all numbers in range 1 to P-1 where i ranges from 1 to P-1. Due to government’s erratic power cut operations, prithvi has malfunctioned and failed to execute it
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