%I #14 May 20 2026 09:03:25
%S 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,17,19,17,0,19,0,16,0,0,25,27,0,
%T 30,21,7,25,34,0,30,15,31,33,39,31,32,0,22,37,42,35,44,33,41,49,44,0,
%U 53,39,53,47,54,0,59,61,61,61,63,47,66,65,64,67,70,71
%N Largest number k in 1..n such that GCD(n,k) = 1 and the greedy Egyptian fraction representation of k/n has more terms than the shortest representation of k/n as a sum of unit fractions; or 0 if no such k exists.
%H Pontus von Brömssen, <a href="/A395996/b395996.txt">Table of n, a(n) for n = 1..10000</a>
%H <a href="/index/Ed#Egypt">Index entries for sequences related to Egyptian fractions</a>.
%F a(n) = 0 if and only if n is in A396000.
%F a(n) = n-1 if and only if n = 1 or n is in A396160.
%e For n = 17, 4/17 is the only fraction for which the greedy Egyptian fraction representation has more terms than the shortest representation, so a(17) = 4.
%e For n = 38 there are 2 such fractions, 9/38 and 15/38, so a(38) = 15. For the larger fractions 28/38 = 14/19 and 34/38 = 17/19, the greedy Egyptian fraction representations also have more terms than the shortest representations, but since both 28 and 34 have a common factor with 38 they are discarded.
%Y Cf. A050205, A097847, A395994, A395995, A395997, A395998, A395999, A396000, A396001, A396160.
%K nonn
%O 1,17
%A _Pontus von Brömssen_, May 14 2026