login
Largest solution to phi(x) - pi(x) = n or 0 if no such solution exists.
4

%I #16 Jul 21 2017 08:35:57

%S 30,60,90,84,210,78,72,150,126,180,132,80,168,138,240,68,330,420,174,

%T 162,300,390,92,234,294,228,360,222,116,246,118,336,630,510,312,450,

%U 378,288,480,280,318,77,660,260,324,396,546,540,840,372,504,408,350,600

%N Largest solution to phi(x) - pi(x) = n or 0 if no such solution exists.

%C Although pi takes all values, solutions are not guaranteed since nontotient numbers exist.

%C a(63) does not exist since by bounds on phi and pi, phi(x) - pi(x) > 129 > 63 for x > 2000 and no smaller x yields a difference of 63. [_Charles R Greathouse IV_, Oct 31 2011]

%F a(n) = Max{x: A000010(x) - A000720(x) = n}

%e n=92: phi(92)=44, pi(92)=24, a(44-24)=a(20)=92; n=63: no solution was found at x<=1000000.

%e a(-2) = 30, since phi(30) - pi(30) = 8 - 10 = -2.

%t Function[s, Function[t, Take[#, 54] &@ ReplacePart[t, Map[# + 3 -> Lookup[s, #][[-1]] &, Keys@ s]]]@ ConstantArray[0, Max@ Keys@ s + 3]]@ KeySort@ PositionIndex@ Array[EulerPhi@ # - PrimePi@ # &, 10^5] (* _Michael De Vlieger_, Jul 20 2017 *)

%Y Cf. A000010, A000720, A037228, A037171, A073453-A073457, A072530, A072531, A073461, A073462.

%K nonn

%O -2,1

%A _Labos Elemer_, Aug 02 2002

%E a(-2) added by _Michael De Vlieger_, Jul 21 2017