Math::N...sciiSelf(3)
π Math::N...sciiSelf(3) π
okay bestie, so this is a page from the User Contributed Perl Documentation and the module is called Math::NumSeq::AsciiSelf β yes the header got truncated to Math::N...sciiSelf(3) because man pages are dramatic like that π
. anyway. sit down, hydrate, we're learning about a sequence that is literally its own ASCII. no cap.
β¨ NAME β¨
Math::NumSeq::AsciiSelf β the sequence that is its own ASCII digits π«Ά like it's self-referential AND self-sufficient, main character energy fr fr
πΈ SYNOPSIS πΈ
use Math::NumSeq::AsciiSelf;
my $seq = Math::NumSeq::AsciiSelf->new;
my ($i, $value) = $seq->next;
that's it. that's the whole vibe. three lines and you're in π
π¦ DESCRIPTION π¦
So. This is a sequence that is itself in ASCII. Sloane's OEIS says it's A109733 β¨
53, 51, 53, 49, 53, 51, 52, 57, etc
and here's the tea, bestie: the first value 53 is made of the digits 5,3 β and 5,3 in ASCII is the initial 53, plus 51 appended. That new 51 is digits 5,1, which is ASCII 53 and 49, and those get appended. Then those new digits 5,3,4,9 are ASCII 53,51,52,57 which get appended, and so on and so on, forever, like a group chat that never dies π
Notice (and this is the iconic part π) that if you interpret the sequence values as ASCII, you get the digits of the sequence itself. And conversely, if you expand each value to its digits represented in ASCII, the sequence is left unchanged. It's giving self-portrait. It's giving mirror. It's giving β¨ recursive queen β¨
The default is digits in decimal. There's an experimental, mostly-working "radix" parameter so you can do it in other bases. Lowkey a few of them are boring though: bases 8, 12 and 16 end up as repetitions of a single value, which is not very interesting, I'm sorry, I said what I said π. Bases 5, 9 and 13 have a choice of two starting self-ASCII values, but only the smallest is used for now. And in base 7, ith() is wrong, but next() is right π (more on that in BUGS, bestie, don't @ me).
π FUNCTIONS π
See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes. shared lore, iykyk π
"$seq = Math::NumSeq::AsciiSelf->new ()"β create and return a new sequence object β¨ fresh out the box, no baggage
π Random Access π
"$value = $seq->ith($i)"β return the$i'th member of the sequence. The first isi=1. one-indexed, we're not doing the zero thing here π
β FORMULAS β
π§ Ith
The doubling described above is the key to the sequence structure. Numbering from k=i-1, so k=0 is the first member, take the bits of k from high to low. Start with value 53. At each bit, expand the value to its digits in ASCII β so for example 53 -> 53,51. Then take the first or second according to whether the bit from k is 0 or 1. cute, right? a little bit-picking buffet π
π₯ Next
The bits of k for the ith calculation can be retained and incremented by a carry algorithm, rather than breaking down in each next() call. The two expanded ASCII values can be kept at each bit and selected by the bit value. efficiency slay π
π Radix
With the experimental "radix" parameter, for base 6 and smaller the ASCII expands to 3 or more values. For example 48 in binary is 110000, so six ASCII 49,49,48,48,48,48. The calculations are the same, but digits of that size rather than bits.
In base 7 the digit lengths vary, since 48=66[7] and 49=100[7], so for it the digit range depends on the expansion. That's fine for next() where the number of digits at each state is available, but how best might ith() notice the shorter count for zeros? π€ an open question, a mystery, a little cliffhanger
π BUGS π
ith()gives wrong values for the experimental"radix"parameter for radix7.can('ith')returns false for that radix, as a way of sayingith()is not available. (Other bases are ok.)
so like, if you try to use ith() on radix 7, don't. it's lying to you π the can('ith') returning false is the module being honest about its own limits, which is growth honestly. other bases are fine, we don't talk about radix 7 π«Ά
π SEE ALSO π
Math::NumSeq β go read it, it's the parent, the blueprint, the origin story β¨
πΈ HOME PAGE πΈ
<http://user42.tuxfamily.org/math-numseq/index.html>
go click it, bestie, it's free real estate π
π 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 warranty bestie, I cannot stress this enough, it's giving "use at your own risk" and honestly? respect π
and that's the whole page!! π¦ this was Math::N...sciiSelf(3) from perl v5.42.0, dated 2025-07-25 β thanks for reading, ily, go write a self-describing sequence, periodt β¨ππ
π¦ 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