1Math::NumSeq::HarshadNuUmsbeerrsC(o3n)tributed Perl DocuMmaetnht:a:tNiuomnSeq::HarshadNumbers(3)
2
3
4
6 Math::NumSeq::HarshadNumbers -- numbers divisible by sum of digits
7
9 use Math::NumSeq::HarshadNumbers;
10 my $seq = Math::NumSeq::HarshadNumbers->new;
11 my ($i, $value) = $seq->next;
12
14 The harshad numbers 1 to 10, then 12, 18, 20, 21, etc, being integers
15 which are divisible by the sum of their digits. For example 18 is a
16 harshad number because 18 is divisible by its digit sum 1+8=9.
17
19 See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
20 classes.
21
22 "$seq = Math::NumSeq::HarshadNumbers->new ()"
23 "$seq = Math::NumSeq::HarshadNumbers->new (radix => $r)"
24 Create and return a new sequence object.
25
26 The optional "radix" parameter (default 10, decimal) sets the base
27 to use for the digits.
28
29 "$bool = $seq->pred($value)"
30 Return true if $value is a harshad number, ie. is divisible by the
31 sum of its digits (in the given "radix").
32
34 Math::NumSeq, Math::NumSeq::DigitSum, Math::NumSeq::MoranNumbers
35
37 <http://user42.tuxfamily.org/math-numseq/index.html>
38
40 Copyright 2011, 2012, 2013, 2014, 2016, 2019, 2020 Kevin Ryde
41
42 Math-NumSeq is free software; you can redistribute it and/or modify it
43 under the terms of the GNU General Public License as published by the
44 Free Software Foundation; either version 3, or (at your option) any
45 later version.
46
47 Math-NumSeq is distributed in the hope that it will be useful, but
48 WITHOUT ANY WARRANTY; without even the implied warranty of
49 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
50 General Public License for more details.
51
52 You should have received a copy of the GNU General Public License along
53 with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>.
54
55
56
57perl v5.34.1 2022-06-06 Math::NumSeq::HarshadNumbers(3)