Editorial for DMOPC '21 Contest 10 P5 - Number Theory


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Author: zhouzixiang2004

Hint 1 Pure brute force should have a very hard time finding a solution. Try to get some intuition about what a valid n would look like.
Hint 2 Let n=p1e1p2e2pkek be its prime factorization. Rewrite d(φ(n))=φ(d(n)) as d((p11)(p21)(pk1)p1e11p2e21pkek1)=φ((e1+1)(e2+1)(ek+1)). For now, it seems hard to control both the left and right side if we consider varying ei. Can we restrict the search space to make it easier?
Hint 3 For now, consider n such that every prime factor occurs only once (i.e. ei=1).
Hint 4 We need d((p11)(p21)(pk1))=φ(2k)=2k1. Intuitively, the left side is almost always larger than the right side, especially since we cannot use pi1=1. How should the prime factors of pi1 relate to each other if we want to keep d((p11)(p21)(pk1)) small?
Hint 5 We should consider using primes pi such that pi1 only contains small prime factors, e.g. only 2 and 3.
Hint 6 Trying to find an n by hand is tedious and prone to only finding a large n. However, we are allowed to use computer assistance.
Hint 7 Write a recursive backtracking program that tries all n under 1018 where n's prime factors pi are all distinct and pi1 only contains small prime factors. This should quickly find many large solutions for n. If we search for smaller n, we should be able to find two values of n with 13 digits beginning with 12???????????, which gets 80% of the points.
Hint 8 The key intuition needed is that we should consider using primes pi such that pi1 only contains small prime factors. Recall that we restricted ourselves to using only ei=1 earlier. Modify the recursive backtracking program to consider n where some prime factors occur more than once (ei>1). We should be able to find a value of n with 11 digits beginning with 15?????????, which gets 100% of the points.
Answer Two intended n for 80% of the points are 1244586078645=35713193773109163 and 1294951381815=35713171937163487.

The intended n for full points is 15230439315=365713173773.

Comments


  • 5
    X_Ray  commented on June 28, 2022, 5:40 p.m.

    Is there another valid value for n that's smaller than 417, and if there isn't, is there a proof that 15230439315 is the lowest odd n that satisfies ϕ(d(n))=d(ϕ(n))?


    • -4
      fleac1  commented on Sept. 9, 2022, 3:49 p.m.

      wagwan