%I #10 Aug 26 2017 14:47:13
%S 1,1,3,1,3,1,5,7,11,23,7,1,43,31,17,1,19,1,31,127,89,47,17,601,2731,
%T 73,113,1103,151,1,257,89,43691,127,73,223,174763,8191,41,13367,337,
%U 9719,683,631,178481,4513,257,127,1801,11119,2731
%N Second-largest prime factor of 2^n - 1, if composite, or 1 otherwise.
%C For clarification: if the largest prime factor occurs more than once, then that prime factor is selected.
%H Charles R Greathouse IV, <a href="/A283461/b283461.txt">Table of n, a(n) for n = 2..1206</a>
%F a(n) = A006530(A000225(n)/A005420(n)).
%t a[n_] := If[PrimeQ[2^n-1], 1, Block[{f = FactorInteger[2^n-1]}, If[f[[-1, 2]] == 1, f[[-2, 1]], f[[-1, 1]]]]]; a /@ Range[2, 52] (* _Giovanni Resta_, Mar 08 2017 *)
%o (PARI) a(n)=my(f=factor(2^n-1),t=#f~); if(f[t,2]>1, f[t,1], if(t>1, f[t-1,1], 1))
%Y Cf. A005420, A193615, A006530, A000225, A108974.
%K nonn
%O 2,3
%A _Charles R Greathouse IV_, Mar 08 2017