This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A374163 #29 Jul 25 2024 14:48:21 %S A374163 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, %T A374163 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, %U A374163 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 %N 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. %e A374163 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. %p A374163 sigma_iterate := proc (n, k) %p A374163 local sigma_result, i: %p A374163 sigma_result := n: %p A374163 for i to k do %p A374163 sigma_result := sigma(sigma_result) %p A374163 end do: %p A374163 return sigma_result %p A374163 end proc: %p A374163 find_min_k := proc (n) %p A374163 local k, sigma_k_n, prime_candidate: %p A374163 k := 0: %p A374163 do %p A374163 k := k+1: %p A374163 sigma_k_n := sigma_iterate(n, k): %p A374163 prime_candidate := sigma_k_n - 1: %p A374163 if isprime(prime_candidate) then %p A374163 return k %p A374163 end if %p A374163 end do %p A374163 end proc: %p A374163 map(find_min_k, [$ 2 .. 100]); %t A374163 A374163[n_] := If[n==1, 1, Length[NestWhileList[DivisorSigma[1, #]&, n, !PrimeQ[# - 1]&, {2, 1}]] - 1]; Array[A374163, 100] (* _Paolo Xausa_, Jul 24 2024 *) %o A374163 (PARI) a(n) = my(k=1, s=sigma(n)); while(!isprime(s-1), k++; s = sigma(s)); k; \\ _Michel Marcus_, Jun 29 2024 %Y A374163 Cf. A000203, A066421. %K A374163 nonn %O A374163 1,4 %A A374163 _Rafik Khalfi_, Jun 29 2024 %E A374163 Offset corrected by _N. J. A. Sloane_, Jul 25 2024