A374163 a(1) = 1; for n>1 a(n) is the minimum value of k > 0 such that sigma^{k}(n)-1 is prime, if such a k exists; otherwise -1, where sigma^{k} is the k-th iteration of sigma=A000203.
1, 1, 1, 2, 1, 1, 1, 2, 2, 1, 1, 4, 1, 1, 1, 2, 1, 4, 1, 1, 1, 5, 1, 1, 2, 1, 2, 3, 1, 1, 1, 2, 1, 1, 1, 4, 1, 1, 3, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 7, 1, 2, 2, 7, 1, 3, 1, 1, 2, 1, 2, 1, 1, 2, 8, 2, 1, 1, 1, 1, 2, 1, 1, 1, 3, 1, 1, 7, 2
Offset: 1
Keywords
Examples
For n=12, sigma^{4}(12)-1 = 360-1 = 359 is prime, and there is no positive k<4 such that sigma^{k}(12)-1 is prime, so a(12)=4.
Programs
-
Maple
sigma_iterate := proc (n, k) local sigma_result, i: sigma_result := n: for i to k do sigma_result := sigma(sigma_result) end do: return sigma_result end proc: find_min_k := proc (n) local k, sigma_k_n, prime_candidate: k := 0: do k := k+1: sigma_k_n := sigma_iterate(n, k): prime_candidate := sigma_k_n - 1: if isprime(prime_candidate) then return k end if end do end proc: map(find_min_k, [$ 2 .. 100]);
-
Mathematica
A374163[n_] := If[n==1, 1, Length[NestWhileList[DivisorSigma[1, #]&, n, !PrimeQ[# - 1]&, {2, 1}]] - 1]; Array[A374163, 100] (* Paolo Xausa, Jul 24 2024 *)
-
PARI
a(n) = my(k=1, s=sigma(n)); while(!isprime(s-1), k++; s = sigma(s)); k; \\ Michel Marcus, Jun 29 2024
Extensions
Offset corrected by N. J. A. Sloane, Jul 25 2024