← All problemsSign in

NN Numbers

Let F(k) = (A^k)Mod(N) [ Where Mod means Modulo operation ex: (17)Mod(5)=2]. Where k can take values from the set S = {1,2,3...N-1}. Now for any given number say N, we say that A is its NN number if the set of values generated by function F (using k from S) is S. Example: Say N = 7 and A = 3 S = {1,2,3,4,5,6} Now F(1) = (3^1)Mod(7) = 3 F(2) = (3^2)Mod(7) = 2 F(3) = (3^3)Mod(7) = 6 F(4) = (3^4)

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