%I #31 Sep 25 2021 15:00:08
%S -1,-1,2,-1,3,-1,5,6,4,8,7,-1,11,10,14,-1,13,12,17,18,15,21,19,-1,9,
%T 22,26,20,23,24,29,28,27,33,34,-1,31,35,38,30,37,40,41,32,44,39,43,-1,
%U 25,45,46,50,47,42,51,54,55,57,53,-1,59,58,52,-1,62,56,61,63,65,66,67
%N a(n) is the greatest k, 0 < k < n, such that tau(k) = tau(n), or -1 if no such k exists, where tau is A000005.
%C a(n) = -1 if and only if n is a term in A005179.
%H Amiram Eldar, <a href="/A347982/b347982.txt">Table of n, a(n) for n = 1..10000</a>
%e a(1) = -1 because there is no positive number less than 1 having 1 divisor.
%e a(2) = -1 because 2 is the first prime.
%e a(3) = 2 because 2 is the greatest prime less than 3 and all primes have 2 divisors.
%t a[1] = -1; a[n_] := Module[{k = n - 1, d = DivisorSigma[0, n]}, While[k > 0 && DivisorSigma[0, k] != d, k--]; If[k == 0, -1, k]]; Array[a, 100] (* _Amiram Eldar_, Sep 23 2021 *)
%o (PARI) a(n) = my(nd=numdiv(n)); forstep(k=n-1, 1, -1, if (numdiv(k)==nd, return(k))); return(-1); \\ _Michel Marcus_, Sep 22 2021
%Y Cf. A000005, A005179, A079427, A079427, A140635.
%K sign
%O 1,3
%A _David James Sycamore_, Sep 22 2021