Problem 51798. Label primes with the Erdos-Selfridge classification

Erdos and Selfridge developed a scheme for classifying a prime number p: If the only factors of p+1 are 2 and 3, then put p in class 1. Otherwise, find the largest class r of the factors of p+1 and put p in class r+1.
For example, 11 is in class 1 because 12 has prime factors 2, 2, and 3. The number 43 is in class 2 because 44 has prime factors 2, 2, and 11, and all of those are in class 1. All Mersenne primes are in class 1, and all ugly numbers are in classes 1 or 2.
Write a function to classify prime numbers using this scheme.

Solution Stats

78.26% Correct | 21.74% Incorrect
Last Solution submitted on Sep 12, 2024

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers13

Suggested Problems

More from this Author273

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!