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
41 BigInt 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 Kevin Ryde
54
55 Math-NumSeq is free software; you can redistribute it and/or modify it
56 under the terms of the GNU General Public License as published by the
57 Free Software Foundation; either version 3, or (at your option) any
58 later version.
59
60 Math-NumSeq is distributed in the hope that it will be useful, but
61 WITHOUT ANY WARRANTY; without even the implied warranty of
62 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
63 General Public License for more details.
64
65 You should have received a copy of the GNU General Public License along
66 with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>.
67
68
69
70perl v5.32.1 2021-01-27 Math::NumSeq::SqrtDigits(3)