0

I want to write some code that inverts Euler's totient, so solving the equation:

$$\varphi(n)=x$$

where $x$ is known.

Before reinventing the wheel, I googled around to see if there was already something, and I was quite amazed to find nothing. Maybe I was somehow naive - that's an option. Is there some well known algorithm performing this task? If not, is there a specific reason why?

Best,

K.

  • If $x$ is odd and not $1$, there are no solutions. Half the problem solved? =) – Pedro Apr 09 '14 at 17:50
  • You might want to explore http://oeis.org/A005277 and the references cited there – Mark Bennet Apr 09 '14 at 17:51
  • Factoring is a hard problem. If you could invert Euler's phi function, you could crack RSA. – ml0105 Apr 09 '14 at 17:51
  • So the only reason why there is no formalization is its NP-completeness? – user138364 Apr 09 '14 at 17:53
  • See http://math.stackexchange.com/questions/23947/how-to-solve-the-equation-phin-k, in particular the references listed in http://math.stackexchange.com/a/23955/589. – lhf Apr 09 '14 at 17:55
  • See also http://math.stackexchange.com/questions/42913/deciding-whether-a-given-number-is-a-totient-or-nontotient. – lhf Apr 09 '14 at 17:55
  • This last one is very interesting! – user138364 Apr 09 '14 at 17:57
  • Inverting the Euler totient function, and similarly factoring a composite integer, are believed to be hard problems but they have never been proved to be hard. So there may be polynomial time algorithms for them that just haven't been found yet. However, I seriously doubt that you'll ever get a resolution to that question on a forum like this. If anyone ever settles the hardness of factoring or inverting the totient function they'll be famous. – user2566092 Apr 09 '14 at 18:05

1 Answers1

1

Another reason there is no discussion of an inverse of Euler's totient function is that it is not injective, therefore possesses no inverse. Here are all numbers $n \geq 1$ with $\phi(n) \leq 52,$ with $\phi(n)$ printed first on each line. Such a list is finite, as $$ \sqrt \frac{n}{2} \leq \phi(n) \leq n $$

phi(n)         n
   1           1
   1           2

   2           3
   2           4
   2           6

   4          10
   4          12
   4           5
   4           8

   6          14
   6          18
   6           7
   6           9

   8          15
   8          16
   8          20
   8          24
   8          30

  10          11
  10          22

  12          13
  12          21
  12          26
  12          28
  12          36
  12          42

  16          17
  16          32
  16          34
  16          40
  16          48
  16          60

  18          19
  18          27
  18          38
  18          54

  20          25
  20          33
  20          44
  20          50
  20          66

  22          23
  22          46

  24          35
  24          39
  24          45
  24          52
  24          56
  24          70
  24          72
  24          78
  24          84
  24          90

  28          29
  28          58

  30          31
  30          62

  32         102
  32         120
  32          51
  32          64
  32          68
  32          80
  32          96

  36         108
  36         114
  36         126
  36          37
  36          57
  36          63
  36          74
  36          76

  40         100
  40         110
  40         132
  40         150
  40          41
  40          55
  40          75
  40          82
  40          88

  42          43
  42          49
  42          86
  42          98

  44         138
  44          69
  44          92

  46          47
  46          94

  48         104
  48         105
  48         112
  48         130
  48         140
  48         144
  48         156
  48         168
  48         180
  48         210
  48          65

  52         106
  52          53

phi(n)         n
Will Jagy
  • 139,541