NAME

Math::NumSeq::ErdosSelfridgeClass -- classification of primes

SYNOPSIS

use Math::NumSeq::ErdosSelfridgeClass;
my $seq = Math::NumSeq::ErdosSelfridgeClass->new;
my ($i, $value) = $seq->next;

DESCRIPTION

A classification of primes by Erdos and Selfridge, or 0 if composite.

0,1,1,0,1,0,1,0,0,0,1,0,2,0,0,0,1,0,2,0,0,0,1,0,0,0,0,0,2,...

A prime p is classified according to the prime factors of p+1. If the maximum class among those factors is c then p has class one above that, ie. c+1.

Primes 2 and 3 are reckoned as class 1, as are any primes where p+1 has factors 2 and 3 only, p=2^x+3^y-1. For example i=11 has 11+1=12=2*2*3 so it's class 1.

The classification essentially asks how many iterations of factorizing p+1 it takes to get to down to factors 2 and 3 only. For example i=617 has 617+1=2*3*103, then 103+1=104=2*13, then 13+1=2*7. 7 is a class 1, so 13 is a class 2, 103 is class 3, and finally 617 is class 4.

FUNCTIONS

See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.

$seq = Math::NumSeq::ErdosSelfridgeClass->new ()

Create and return a new sequence object.

$bool = $seq->ith($value)

Return the class number of $value, or 0 if $value is not a prime.

$bool = $seq->pred($value)

Return true if $value occurs as a classification in the sequence, which means any integer $value >= 0.

SEE ALSO

Math::NumSeq, Math::NumSeq::Primes