Math::N...StepsSum(3)
π Math::NumSeq::TotientStepsSum β the manual, but make it cute β¨
okay so bestie, you're reading the Math::N...StepsSum(3) page from the User Contributed Perl Documentation, and honestly? it's giving math girlie main character energy and i'm obsessed. let's get into it π
πΈ NAME πΈ
Math::NumSeq::TotientStepsSum β it's the sum of repeated totients to reach 1. like, you keep totient-ing and totient-ing until you hit 1, and you add up everything you touched along the way. periodt π
β¨ SYNOPSIS β¨
use Math::NumSeq::TotientStepsSum;
my $seq = Math::NumSeq::TotientStepsSum->new;
my ($i, $value) = $seq->next;
that's it, that's the whole vibe. create the object, call next, get numbers back π¦
π DESCRIPTION π
so the deal is: you take the totient function and you just. keep. applying it. over and over. until you finally land on 1. and the value is the sum of all the totients along that little journey.
here's the sequence, no cap:
1, 3, 6, 7, 12, 9, 16, 15, 18, 17, 28, 19, 32, ...
let's do a lil example because i know you love a concrete number π take i=5. applying the totient function goes:
5 -> 4 -> 2 -> 1
so the total is value=5+4+2+1=12. ate. π₯
now, by default the sequence includes the initial i itself in the sum. but if you pass including_self => 0 it excludes it, and then for example i=5 has value=4+2+1=7. look how the sequence changes when you do that:
0, 1, 3, 3, 7, 3, 9, 7, 9, 7, 17, 7, 19, ...
lowkey a whole different girl, right? π
also, if you want totient sums that equal i itself (iconic behaviour honestly), go peek at Math::NumSeq::TotientPerfect.
π«Ά FUNCTIONS π«Ά
for the stuff that's common to literally every sequence class, check out "FUNCTIONS" in Math::NumSeq. we love shared behaviour π
$seq = Math::NumSeq::TotientStepsSum->new ()β makes you a shiny new sequence object and hands it right back to you. slay.
π§ Random Access π§
$value = $seq->ith($i)β gives you the totient steps sum runningiall the way down to 1. jump straight in, no scrolling required π
π SEE ALSO π
Math::NumSeqMath::NumSeq::TotientMath::NumSeq::TotientStepsMath::NumSeq::TotientPerfect
go read them, they're all in the same friend group π¦
π HOME PAGE π
<http://user42.tuxfamily.org/math-numseq/index.html>
π LICENSE π
Copyright 2011, 2012, 2013, 2014, 2016, 2019, 2020 Kevin Ryde
Math-NumSeq is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Math-NumSeq is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>.
no cap on the warranty disclaimer bestie, it's literally all caps for a reason π
okay that's the whole page, go forth and sum some totients πβ¨ this was perl v5.42.0, dated 2025-07-25, and yes the page is still called Math::N...StepsSum(3) β she's truncated and she's thriving π
π
π¦ where this page comes from
- fedora 43: perl-Math-NumSeq 75-11.fc43 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms