cp's OEIS Frontend

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.

A361685 Number of iterations of sopf until reaching a prime.

Original entry on oeis.org

0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 2, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 1, 3, 1, 2, 0, 2, 0, 1, 3, 1, 2, 1, 0, 3, 2, 1, 0, 2, 0, 1, 2, 2, 0, 1, 1, 1, 2, 3, 0, 1, 2, 2, 2, 1, 0, 2, 0, 4, 2, 1, 2, 2, 0, 1, 4, 3, 0, 1, 0, 3, 2, 3, 2, 2, 0, 1, 1, 1, 0, 2, 2, 3, 2, 1, 0, 2, 2, 2, 2, 2, 2, 1, 0, 2, 3, 1, 0
Offset: 2

Views

Author

J. W. Montgomery, Mar 29 2023

Keywords

Examples

			a(15) = 2 because 15 is not prime, sopf(15) = 8 is not prime, and sopf^2(15) = sopf(8) = 2 is prime.
a(16) = 1 because 16 is not prime and sopf(16) = 2 is prime.
a(17) = 0 because 17 is prime.
		

Crossrefs

Cf. A008472 (sopf), A321944.

Programs

  • MATLAB
    for n=2:101
        s = n;
        c = 0;
        while ~isprime(s)
            s = sum(unique(factor(s)));
            c = c + 1;
        end
        a(n) = c;
    end
    
  • PARI
    A008472(n) = vecsum(factor(n)[, 1]);
    A361685(n) = for(k=0,oo,if(isprime(n),return(k)); n = A008472(n)); \\ Antti Karttunen, Jan 28 2025

Formula

For n >= 2, a(n) = min{m : sopf^m(n) is prime} where sopf^m indicates m iterations of sopf, the sum of the prime factors function.
a(n) = A321944(n) - 1. - Rémy Sigrist, Mar 29 2023