Math::N...Aronson(3)

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

πŸ’– Math::N...Aronson β€” bestie edition πŸ’–

okay so this is Math::NumSeq::NumAronson, a lil Perl module that lives in the User Contributed Perl Documentation manual section, and it does the numerical version of Aronson's sequence. yes, that Aronson's sequence. we're doing numbers now. slay. πŸ’…


✨ NAME ✨

Math::NumSeq::NumAronson β€” numerical version of Aronson's sequence πŸŽ€


🌸 SYNOPSIS 🌸

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

that's it. that's the whole vibe. you make the object, you keep pulling values out, iconic. πŸ’–


πŸ¦‹ DESCRIPTION πŸ¦‹

so this is a self-referential sequence by Cloitre, Sloane and Vandermast, from a paper called:

"Numerical Analogues of Aronson's Sequence", <http://arxiv.org/abs/math.NT/0305308>

and bestie, the sequence starts off like this:

1, 4, 6, 7, 8, 9, 11, 13, ...
starting i=1

ngl the rule is so cute and so weird. starting with a(1)=1, the rule is literally "n is in the sequence iff a(n) is odd". that's the whole thing. self-referential queen behavior. πŸ‘‘

and what you get out of that is a uniform pattern: 3 steps by 1, then 3 steps by 2, then 6 steps by 1, then 6 steps by 2, then 12, 24, 48, etc. it just keeps doubling forever, fr fr.

1,
4,
6,  7,  8,                   # 3 steps by 1
9,  11, 13,                  # 3 steps by 2
15, 16, 17, 18, 19, 20,      # 6 steps by 1
21, 23, 25, 27, 29, 31,      # 6 steps by 2
                             # 3*2^k steps by 1
                             # 3*2^k steps by 2

and in general, the formula is:

numaronson(9*2^k-3+j) = 12*2^k - 3 + (3*j+abs(j))/2
where -3*2^k <= j < 3*2^k

the (3*j+abs(j))/2 bit? that's the step, bestie. it goes by 1 if j<=0 and by 2 if j>0. the absolute value is doing so much heavy lifting here and I respect it. 🫢


πŸ”₯ FUNCTIONS πŸ”₯

for the behavior that every sequence class shares, go peek at "FUNCTIONS" in Math::NumSeq. this page is just the NumAronson-specific lore.

  • $seq = Math::NumSeq::NumAronson->new () β€” creates and hands you back a shiny new sequence object. your main character. ⭐

πŸ’œ Random Access πŸ’œ

  • $value = $seq->ith($i) β€” gimme the $ith value in the sequence. random access, no waiting in line. ✨
  • $bool = $seq->pred($value) β€” returns true if $value actually occurs in the sequence. a lil vibe check for your number. 🌈

🌟 SEE ALSO 🌟

  • Math::NumSeq
  • Math::NumSeq::Aronson

the whole squad, basically. go say hi. 🧚


🏠 HOME PAGE 🏠

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

that's the house. that's where it lives. πŸ“


πŸ“œ LICENSE πŸ“œ

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

bestie if you're gonna redistribute it, keep the license with it, okay? it's giving "respect the author's terms." no cap. πŸ’–

and that's the page!! this whole thing is part of the perl v5.42.0 docs, dated 2025-07-25, and it's a User Contributed Perl Documentation situation β€” aka a lil Math::N...Aronson(3) moment in your man pages. go forth and compute, you absolute icon. πŸ‘‘βœ¨πŸ’…

πŸ“¦ where this page comes from