1Math::NumSeq::SqrtDigitUss(e3r)Contributed Perl DocumentMaattiho:n:NumSeq::SqrtDigits(3)
2
3
4
6 Math::NumSeq::SqrtDigits -- the digits of a square root
7
9 use Math::NumSeq::SqrtDigits;
10 my $seq = Math::NumSeq::SqrtDigits->new (sqrt => 7);
11 my ($i, $value) = $seq->next;
12
14 The sequence of digits which are the square root of a given radicand.
15 For example sqrt(2) in decimal 1, 4, 1, 4, 2, 1, etc, being 1.41421
16 etc.
17
18 The default is decimal, or a "radix" can be given. In the current code
19 "Math::BigInt" is used. (For radix 2, 8 and 10 the specific digit
20 conversion methods in BigInt are used, which might be faster than the
21 general case.)
22
24 See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
25 classes.
26
27 "$seq = Math::NumSeq::SqrtDigits->new (sqrt => $s)"
28 "$seq = Math::NumSeq::SqrtDigits->new (sqrt => $s, radix => $r)"
29 Create and return a new sequence object giving the digits of
30 sqrt($s).
31
32 "$bool = $seq->pred($value)"
33 Return true if $value might occurs as a digit in the square root.
34
35 Currently this presumes all digits occur, so simply "$value >= 0"
36 and "$value < $radix". For a perfect square this might be wrong,
37 for a non-square do all digits in fact occur?
38
40 The current code requires "Math::BigInt" bsqrt(), which may mean BigInt
41 1.60 or higher (which comes with Perl 5.8.0 and up).
42
44 Math::NumSeq, Math::NumSeq::SqrtEngel, Math::NumSeq::FractionDigits
45
46 Norman L. de Forest, "The Square Root of 4 to a Million Places", at
47 Project Gutenberg, <http://www.gutenberg.org/ebooks/3651>
48
50 <http://user42.tuxfamily.org/math-numseq/index.html>
51
53 Copyright 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2019, 2020 Kevin
54 Ryde
55
56 Math-NumSeq is free software; you can redistribute it and/or modify it
57 under the terms of the GNU General Public License as published by the
58 Free Software Foundation; either version 3, or (at your option) any
59 later version.
60
61 Math-NumSeq is distributed in the hope that it will be useful, but
62 WITHOUT ANY WARRANTY; without even the implied warranty of
63 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
64 General Public License for more details.
65
66 You should have received a copy of the GNU General Public License along
67 with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>.
68
69
70
71perl v5.36.0 2023-01-20 Math::NumSeq::SqrtDigits(3)