This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/octave -q | |
clear; | |
% n=0: f=b | |
% (∴) b は素数である必要がある | |
% n=1: f=1+a+b | |
% b は素数であることが確定している | |
% b=2の時: a は偶数 | |
% b=2以外: a は奇数 | |
% (∴) a は偶数である必要がある(0も偶数と見なして除外) | |
_b = primes(999); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
my $to = shift; #arg[0] 1001 | |
my $sum = 0; | |
for(my $n=1; $n<=$to; $n+=2){ | |
$sum += get_sum_corner($n); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use Math::BigInt; | |
my ($amin, $amax, $bmin, $bmax) = @ARGV; # 2 100 2 100 | |
my $len = length((Math::BigInt->new($amax)**$bmax)->as_hex()) - 2; | |
my %arr; | |
my $v; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/octave -q | |
% parse arguments | |
_argv = argv(); | |
amin = str2num(char(_argv(1))); | |
amax = str2num(char(_argv(2))); | |
bmin = str2num(char(_argv(3))); | |
bmax = str2num(char(_argv(4))); | |
% calc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
my $pow = shift; # 5 | |
my $max = calc_max($pow); | |
my $len = length($max); # 6 | |
my $ans = 0; | |
for(my $i=2; $i<=$max; $i++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
my $target = shift; | |
my @coins = (200, 100, 50, 20, 10, 5, 2, 1); | |
my @sets = (); | |
my $ans = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use Math::Combinatorics; | |
my @digits = (1,2,3,4,5,6,7,8,9); | |
my %ans = (); | |
#<事前調査その1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
#約分してない答えの分数を作成する | |
my @fractions = (); | |
foreach my $i (1..8) | |
{ | |
foreach my $j (($i+1)..9) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
#n桁の数値のそれぞれの数字の階乗の和の最大値を考える | |
#【6桁】[max] 999999 < 2177280 | |
#【7桁】[max] 9999999 > 2540160 | |
#よって最大は7桁2540160未満 | |
#1桁の数値は明らかに除外 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Math::Prime::XS qw(is_prime); | |
my %ans = (); | |
foreach my $no(2..999999) | |
{ | |
#2桁以上の偶数の数字および5を含む数値は循環して一の位に来たときに素数ではなくなる為除外 |
OlderNewer