Kevin Ryde > Math-NumSeq > Math::NumSeq::TotientStepsSum

Math-NumSeq-72.tar.gz

Dependencies

Annotate this POD

Website

# CPAN RT

 Open 0
View/Report Bugs
Module Version: 72

# NAME

Math::NumSeq::TotientStepsSum -- sum of repeated totients to reach 1

# SYNOPSIS

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

# DESCRIPTION

The sum of the totients on repeatedly applying the totient function to reach 1.

`    1, 3, 6, 7, 12, 9, 16, 15, 18, 17, 28, 19, 32, ...`

For example i=5 applying the totient function goes 5 -> 4 -> 2 -> 1 so total value=5+4+2+1=12.

The default is to include the initial i itself in the sum. Option `including_self => 0` excludes, in which case for example i=5 has value=4+2+1=7.

`    0, 1, 3, 3, 7, 3, 9, 7, 9, 7, 17, 7, 19, ...`

See Math::NumSeq::TotientPerfect for totient sums equal to i itself.

# FUNCTIONS

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

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

Create and return a new sequence object.

## Random Access

`\$value = \$seq->ith(\$i)`

Return the totient steps sum running i down to 1.

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