Math::N...mulative(3)

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

πŸ’– Math::NumSeq::DedekindPsiCumulative β€” bestie edition πŸ’–

okay so this is a page from the User Contributed Perl Documentation manual, and it's about Math::NumSeq::DedekindPsiCumulative, aka the cumulative Psi function. yes the real name is long. no we are not shortening it. she's iconic and she earned every character. 🌸


✨ NAME ✨

Math::NumSeq::DedekindPsiCumulative β€” the cumulative Psi function, and yes she's serving math realness πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

here's the whole vibe, copy-paste ready:

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

that's it. that's the whole thing. make the object, call next, get your ($i, $value) pair. slay. ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

so. the cumulative Dedekind Psi function. she goes like this:

1, 4, 8, 14, 20, 32, 40, 52, 64, 82, 94, 118, ...
starting i=1

and the whole personality is:

value = sum n=1 to n=i of Psi(n)

like, you just keep adding up Psi(n) as n climbs from 1 all the way to i. it's a running total. a little pile of Psi's. adorable tbh πŸ₯Ί

and where does each Psi(n) come from? she's defined as:

Psi(n) =        product          (p+1) * p^(e-1)
         prime factors p^e in n

so you look at the prime factorization of n, and for each prime factor written as p^e you multiply in (p+1) * p^(e-1). multiply all of those together, and boom, that's Psi(n). 🧚

what does the p+1 mean tho? it means one copy of each distinct prime in n gets changed from p to p+1. that's the whole trick, lowkey.

this is super similar to Euler's totient function phi(n) (peep Math::NumSeq::Totient if you wanna), except phi(n) uses p-1 instead of p+1. same energy, different sign. literally one character apart and they're living completely different lives πŸ’€


πŸ”₯ FUNCTIONS πŸ”₯

heads up bestie, for all the behaviour that's common to every sequence class, go read "FUNCTIONS" in Math::NumSeq. that's where the shared lore lives.

  • $seq = Math::NumSeq::DedekindPsiCumulative->new () β€” makes you a brand new sequence object and hands it back to you. that's it. that's the job. 🫢
  • $i = $seq->value_to_i_estimate($value) β€” gives you an estimate of the i that goes with $value. note the word estimate, she is not promising you exact, she is promising you close. rn it's based on the asymptotic:
value = 15*n^2/(2*Pi^2) + O(n*log(n))

and if you just… ignore the O(n*log(n)) part (rude of it to be there, honestly), it becomes:

i ~= sqrt(value) * pi/sqrt(15/2)

so basically sqrt(value) times pi over sqrt(15/2). math girlies stay winning πŸ“βœ¨


🌈 SEE ALSO 🌈

go read these next, they're the friend group:

  • Math::NumSeq
  • Math::NumSeq::DedekindPsiSteps
  • Math::NumSeq::TotientCumulative

πŸ‘‘ HOME PAGE πŸ‘‘

the official hangout spot:

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


πŸ’œ LICENSE πŸ’œ

Copyright 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/>.

⚠️ okay real talk for a sec: that "WITHOUT ANY WARRANTY" bit is not a vibe, it's a legal fact. no promises, no guarantees, that's the deal fr fr.

and that's the whole page!! πŸŽ€ this was written for perl v5.42.0, dated 2025-07-25, and it lives in the Math::N...mulative(3) corner of the User Contributed Perl Documentation. mwah, go compute something cute πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from