| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# Copyright 2011, 2012, 2013, 2014 Kevin Ryde |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# This file is part of Math-NumSeq. |
|
4
|
|
|
|
|
|
|
# |
|
5
|
|
|
|
|
|
|
# Math-NumSeq is free software; you can redistribute it and/or modify |
|
6
|
|
|
|
|
|
|
# it under the terms of the GNU General Public License as published by the |
|
7
|
|
|
|
|
|
|
# Free Software Foundation; either version 3, or (at your option) any later |
|
8
|
|
|
|
|
|
|
# version. |
|
9
|
|
|
|
|
|
|
# |
|
10
|
|
|
|
|
|
|
# Math-NumSeq is distributed in the hope that it will be useful, but |
|
11
|
|
|
|
|
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
|
12
|
|
|
|
|
|
|
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13
|
|
|
|
|
|
|
# for more details. |
|
14
|
|
|
|
|
|
|
# |
|
15
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License along |
|
16
|
|
|
|
|
|
|
# with Math-NumSeq. If not, see . |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
package Math::NumSeq::OEIS; |
|
19
|
2
|
|
|
2
|
|
11873
|
use 5.004; |
|
|
2
|
|
|
|
|
8
|
|
|
|
2
|
|
|
|
|
79
|
|
|
20
|
2
|
|
|
2
|
|
14
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
67
|
|
|
21
|
2
|
|
|
2
|
|
13
|
use Carp; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
163
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
2
|
|
|
2
|
|
12
|
use vars '$VERSION','@ISA'; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
152
|
|
|
24
|
|
|
|
|
|
|
$VERSION = 71; |
|
25
|
|
|
|
|
|
|
|
|
26
|
2
|
|
|
2
|
|
680
|
use Math::NumSeq; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
115
|
|
|
27
|
|
|
|
|
|
|
@ISA = ('Math::NumSeq'); |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# uncomment this to run the ### lines |
|
30
|
|
|
|
|
|
|
#use Smart::Comments; |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# use constant name => Math::NumSeq::__('OEIS'); |
|
34
|
2
|
|
|
2
|
|
145
|
use constant description => Math::NumSeq::__('OEIS sequence, by its A-number. There\'s code for some sequences, others look in ~/OEIS directory for downloaded files A123456.internal, A123456.html and/or b123456.txt.'); |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
11
|
|
|
35
|
2
|
|
|
2
|
|
12
|
use constant characteristic_integer => 1; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
842
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# recalculated each time for updated file min/max |
|
38
|
|
|
|
|
|
|
sub parameter_info_array { |
|
39
|
65
|
|
|
65
|
1
|
4099
|
require Math::NumSeq::OEIS::Catalogue; |
|
40
|
|
|
|
|
|
|
return [ |
|
41
|
65
|
|
|
|
|
352
|
{ name => 'anum', |
|
42
|
|
|
|
|
|
|
type => 'string', |
|
43
|
|
|
|
|
|
|
display => Math::NumSeq::__('OEIS A-number'), |
|
44
|
|
|
|
|
|
|
type_hint => 'oeis_anum', |
|
45
|
|
|
|
|
|
|
width => 8, |
|
46
|
|
|
|
|
|
|
minimum => Math::NumSeq::OEIS::Catalogue->anum_first, |
|
47
|
|
|
|
|
|
|
maximum => Math::NumSeq::OEIS::Catalogue->anum_last, |
|
48
|
|
|
|
|
|
|
default => 'A000290', # Squares, an arbitrary choice |
|
49
|
|
|
|
|
|
|
}, |
|
50
|
|
|
|
|
|
|
]; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
### parameter_info_array parameter_info_array() |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub oeis_anum { |
|
55
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
|
56
|
0
|
|
|
|
|
0
|
return $self->{'oeis_anum'}; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub new { |
|
60
|
2
|
|
|
2
|
1
|
2542
|
my ($class, %options) = @_; |
|
61
|
|
|
|
|
|
|
### Values-OEIS: @_ |
|
62
|
|
|
|
|
|
|
|
|
63
|
2
|
|
|
|
|
5
|
my $anum = $options{'anum'}; |
|
64
|
2
|
50
|
|
|
|
11
|
if (! defined $anum) { |
|
65
|
0
|
|
|
|
|
0
|
$anum = parameter_info_array()->[0]->{'default'}; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
### $anum |
|
68
|
|
|
|
|
|
|
|
|
69
|
2
|
|
|
|
|
599
|
require Math::NumSeq::OEIS::Catalogue; |
|
70
|
2
|
|
33
|
|
|
21
|
my $info = Math::NumSeq::OEIS::Catalogue->anum_to_info($anum) |
|
71
|
|
|
|
|
|
|
|| croak 'No data for OEIS sequence ',$anum; |
|
72
|
|
|
|
|
|
|
### $info |
|
73
|
|
|
|
|
|
|
|
|
74
|
2
|
|
|
|
|
60
|
my $numseq_class = $info->{'class'}; |
|
75
|
2
|
|
|
|
|
4
|
my $parameters = $info->{'parameters'}; |
|
76
|
2
|
|
|
|
|
1231181
|
require Module::Load; |
|
77
|
2
|
|
|
|
|
1781
|
Module::Load::load($numseq_class); |
|
78
|
2
|
50
|
|
|
|
59
|
return $numseq_class->new (%options, ($parameters ? @$parameters : ())); |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
|
82
|
|
|
|
|
|
|
__END__ |