Kevin Ryde > Math-NumSeq-63 > Math::NumSeq::TotientPerfect

Math-NumSeq-63.tar.gz

Dependencies

Annotate this POD

Website

# CPAN RT

 Open 1
View/Report Bugs
Module Version: 63   Source   Latest Release: Math-NumSeq-67

# NAME

Math::NumSeq::TotientPerfect -- sum of repeated totients is N itself

# SYNOPSIS

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

# DESCRIPTION

Numbers for which the sum of repeated totients until reaching 1 gives the starting n itself.

3, 9, 15, 27, 39, 81, 111, 183, 243, 255, ...

For example totient(15)=8, totient(8)=4, totient(4)=2 and totient(1)=1. Adding them up 8+4+2+1=15 so 15 is a perfect totient.

The current implementation of next() is merely a search by pred() through all odd integers, which isn't very fast.

# FUNCTIONS

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

\$seq = Math::NumSeq::TotientPerfect->new ()

Create and return a new sequence object.

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

Return true if \$value is a perfect totient.

http://user42.tuxfamily.org/math-numseq/index.html