login
n - 1 mod phi(n), where phi(n) is Euler's totient function.
4

%I #21 Sep 08 2022 08:46:03

%S 0,0,0,1,0,1,0,3,2,1,0,3,0,1,6,7,0,5,0,3,8,1,0,7,4,1,8,3,0,5,0,15,12,

%T 1,10,11,0,1,14,7,0,5,0,3,20,1,0,15,6,9,18,3,0,17,14,7,20,1,0,11,0,1,

%U 26,31,16,5,0,3,24,21,0,23,0,1,34,3,16,5,0,15,26,1,0,11,20,1,30,7,0,17

%N n - 1 mod phi(n), where phi(n) is Euler's totient function.

%C Lehmer conjectured that a(n) = 0 only when n is 1 or prime.

%H Charles R Greathouse IV, <a href="/A215486/b215486.txt">Table of n, a(n) for n = 1..10000</a>

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Lehmer&#39;s_totient_problem">Lehmer's totient problem</a>

%e a(8) = 3 because 8 - 1 mod phi(8) = 3.

%e a(9) = 2 because 9 - 1 mod phi(9) = 2.

%e a(10) = 1 because 10 - 1 mod phi(10) = 1.

%t Table[Mod[n - 1, EulerPhi[n]], {n, 2, 100}]

%o (Magma) [(n-1) mod EulerPhi(n): n in [2..90]]; // _Bruno Berselli_, Feb 18 2013

%o (Maxima) makelist(mod(n-1,totient(n)), n, 2, 90); /* _Bruno Berselli_, Feb 18 2013 */

%o (PARI) a(n)=(n-1)%eulerphi(n) \\ _Charles R Greathouse IV_, Dec 29 2013

%Y Cf. A068494, A007694.

%K nonn,easy

%O 1,8

%A _Alonso del Arte_, Feb 17 2013, based on an idea from _Balarka Sen_.