← All problemsSign in

Careful Calculation

CodeChefRating 2344Open on judge ↗

You are given a single integer N. It's very large, so it's given as a product of several prime powers: N = p1k1 p2k2 ... pmkm. Let's define φ(N) as Euler's totient function -- the number of positive integers less than or equal to N that are relatively prime to N. Let N1 = φ(N). Let N2 = φ(N1). Further, let NX = φ(NX-1) for X > 2. Your task is to find the smallest positive integer X such that NX

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