Math::NumSeq::DigitSumModulo -- digit sum taken modulo a given modulus
use Math::NumSeq::DigitSumModulo; my $seq = Math::NumSeq::DigitSumModulo->new (radix => 10, modulus => 9); my ($i, $value) = $seq->next;
The sum of digits in each i, taken modulo the radix or a given modulus. For example at i=123 with modulus 5 the value is 1+2+3=6, mod 5 = 1.
Modulus 0, which is the default, means modulo the radix.
radix=>2, modulus=>2 this is the Thue-Morse "parity" sequence, being 1 if i has an odd number of 1 bits or 0 if an even number of 1 bits. Numbers where it's 1 are sometimes called "odious" numbers and where it's 0 called "evil" numbers.
See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.
$seq = Math::NumSeq::DigitSumModulo->new (radix => $r, modulus => $d)
Create and return a new sequence object.
$value = $seq->ith($i)
Return the sum of the digits in
radix, modulo the
$bool = $seq->pred($value)
Return true if
$valuemight occur as value in the sequence, which means simply
$value= 0> and
$value <= modulus(the given
Copyright 2011, 2012, 2013 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/>.