HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Problems
  2. /Find every positive integer n with φ(n) = 12…
AdvancedMathematicsHigh School (11–12)Number TheoryNumericalOlympiad

Find every positive integer n with φ(n) = 12…

StemPy LabContributed by StemPy Lab

Try it on paper first. A hint, the key idea and the worked solution are here when you need them.

Find every positive integer nnn with φ(n)=12\varphi(n) = 12φ(n)=12. Use the formula: each prime ppp dividing nnn gives a factor p−1p - 1p−1 of φ(n)\varphi(n)φ(n), so p−1p - 1p−1 must divide 121212. List the possible primes, then try their products and powers. Give how many such nnn there are and the largest of them.

Check your answer

Work it out on paper, then type your number. The answer itself stays hidden.

Need a reminder? The key ideaShowHide

φ(n)\varphi(n)φ(n) counts 1≤k≤n1 \le k \le n1≤k≤n with gcd⁡(k,n)=1\gcd(k, n) = 1gcd(k,n)=1. If gcd⁡(a,n)=1\gcd(a, n) = 1gcd(a,n)=1, Euler's theorem gives

aφ(n)≡1(modn),φ(n)=n∏p∣n(1−1p).\displaystyle a^{\varphi(n)} \equiv 1 \pmod n, \qquad \varphi(n) = n\prod_{p \mid n}\left(1 - \tfrac{1}{p}\right).aφ(n)≡1(modn),φ(n)=np∣n∏​(1−p1​).

The worked solution

Check an answer or open a hint to unlock the worked solution.

Have you tried it?

Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.

Given. φ(n)=12=22⋅3\varphi(n) = 12 = 2^2 \cdot 3φ(n)=12=22⋅3.

Step 1. The primes. If p∣np \mid np∣n, then p−1∣φ(n)p - 1 \mid \varphi(n)p−1∣φ(n). So p−1∈{1,2,3,4,6,12}p - 1 \in \{1, 2, 3, 4, 6, 12\}p−1∈{1,2,3,4,6,12}, and p∈{2,3,5,7,13}p \in \{2, 3, 5, 7, 13\}p∈{2,3,5,7,13} (the value p−1=3p - 1 = 3p−1=3 gives 444, not prime).

Step 2. Powers. φ(pk)=pk−1(p−1)\varphi(p^k) = p^{k-1}(p - 1)φ(pk)=pk−1(p−1). The factor pk−1p^{k-1}pk−1 must divide 121212, so only 232^323 and 323^232 can appear as higher powers, besides first powers.

Step 3. Try the cases. With 131313: φ(13)=12\varphi(13) = 12φ(13)=12 and φ(26)=12\varphi(26) = 12φ(26)=12. With 777 (φ=6\varphi = 6φ=6): 7⋅m7 \cdot m7⋅m with φ(m)=2\varphi(m) = 2φ(m)=2, so m=3,4,6m = 3, 4, 6m=3,4,6, giving 212121, 282828, 424242. With 999 (φ=6\varphi = 6φ=6): 9⋅m9 \cdot m9⋅m with φ(m)=2\varphi(m) = 2φ(m)=2 and 3∤m3 \nmid m3∤m, so m=4m = 4m=4, giving 363636. With 555 (φ=4\varphi = 4φ=4): need another factor with φ=3\varphi = 3φ=3, impossible.

Step 4. The list. n=13,21,26,28,36,42n = 13, 21, 26, 28, 36, 42n=13,21,26,28,36,42.

Check. φ(42)=1×2×6=12\varphi(42) = 1 \times 2 \times 6 = 12φ(42)=1×2×6=12 and φ(36)=2×6=12\varphi(36) = 2 \times 6 = 12φ(36)=2×6=12.

Answer: 666 numbers, the largest being 424242.

Log in to save this for later
← All Problems
← Prove that Σ_(d mid n)φ(d) = n for every positive integer n, by sorting the fractions 1/n, 2/n, ……The numbers 43 and 97 are prime. Use Wilson's theorem to find the remainder of 40! … →
More onNumber Theory

Discussion (0)

Log in to join the discussion.

Loading…

More on this topic

  1. The triangular numbers are 1, 3, 6, 10, …, where the nth one is (n(n + 1))/2…Advanced
  2. Prove that the equation x³ + y³ + z³ = n has no solution in integers when n leaves remainder 4 or 5…Advanced
  3. Find every triple of positive integers a ≤ b ≤ c with 1/a + 1/b + 1/c = 1, and prove that there are…Advanced
  4. Find all pairs of positive integers (x, y) with x² - y² = 945…Hard
  5. A teacher wants a list of every primitive Pythagorean triple whose hypotenuse is less than 100…Advanced
All problems on this topic →