Math::N...StepsSum(3)

πŸ“¦
version 75 Β· 2 versions
, in fedora 43

πŸ’– 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 running i all the way down to 1. jump straight in, no scrolling required πŸ’…

πŸ‘‘ SEE ALSO πŸ‘‘

  • Math::NumSeq
  • Math::NumSeq::Totient
  • Math::NumSeq::TotientSteps
  • Math::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