%I #34 Jan 14 2023 12:41:17
%S 3,5,17,13,71,37,157,61,211,313,1289,241,337,181,577,601,541,1381,421,
%T 1201,1009,1621,1873,3433,4561,1801,3301,2161,3061,5281,3361,2521,
%U 7393,6481,4201,4621,8737,9181,6301,19501,7561,16633,12241,26881,15601,9241,21001,14281,12601,53551
%N Least odd prime p in position n in the prime factorization of M(p) = 2^(p - 1) - 1.
%H Carlos Rivera, <a href="https://www.primepuzzles.net/puzzles/puzz_1116.htm">Puzzle 1116. A358527</a>, The Prime Puzzles & Problems Connection.
%e M(5) = 15 = 3*5 and 5 is in second position in the prime factorization of M(5), and no lesser odd prime satisfies this, so a(2) = 5.
%e M(17) = 65535 = 3*5*17*257 and 17 is in third position in the prime factorization of M(17), and no lesser odd prime satisfies this, so a(3) = 17.
%t f[n_] := Module[{p = Prime[n]}, Count[Prime[Range[n - 1]], _?(PowerMod[2, p - 1, #] == 1 &)] + 1]; f[1] = 0; With[{s = Array[f, 4000]}, ind = TakeWhile[ FirstPosition[s, #] & /@ Range[Max[s]] // Flatten, NumberQ ]; Prime[ind]] (* _Amiram Eldar_, Jan 02 2023 *)
%o (PARI) isok(p, n) = my(f=factor(2^(p-1) - 1, p+1)); if (#f~ < n, 0, f[n,1] == p);
%o a(n) = my(p=3); while(!isok(p, n), p=nextprime(p+1)); p; \\ _Michel Marcus_, Jan 13 2023
%Y Cf. A098102, A358527.
%K nonn
%O 1,1
%A _Jean-Marc Rebert_, Dec 31 2022