← All problemsSign in

Generator

Decipher Codefest'16 Himanshu just got acquainted with the Diffie-Hellman key agreement protocol. He got so excited that he wanted to try out the protocol with Himanshu (the other one). He was all set to exchange the key just when he realized that he doesn't know how to find the generator of a multiplicative group Zp given a large prime number p. Can you help Himanshu in calculating the kth gene

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