1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #!/usr/bin/perl
- # Largest known non-pandigital Carmichael-number?
- # Problem from:
- # https://math.stackexchange.com/questions/4727838/largest-known-non-pandigital-carmichael-number
- use 5.020;
- use strict;
- use warnings;
- use Storable;
- use Math::GMPz;
- use ntheory qw(:all);
- #use Math::Sidef qw(is_fibonacci);
- #use Math::Prime::Util::GMP;
- use experimental qw(signatures);
- use List::Util qw(uniq);
- my $carmichael_file = "cache/factors-carmichael.storable";
- my $carmichael = retrieve($carmichael_file);
- my $t = Math::GMPz::Rmpz_init_set_ui(0);
- my $max = Math::GMPz::Rmpz_init_set_ui(0);
- while(my($key, $value) = each %$carmichael) {
- my @arr = uniq(split(//, $key));
- if (@arr < 9) {
- Math::GMPz::Rmpz_set_str($t, $key, 10);
- if ($t > $max) {
- Math::GMPz::Rmpz_set($max, $t);
- say $key;
- }
- }
- }
- __END__
- 1173134064449194642607772961
- 2707919178335377580229505921
- 2565725525577577667466525242881
- 1192630881882960900848281663080001
- 18009956670998641906961577195758401
- 6108217232633082681906809606009137921
- 11684481601509580514689185125598110210401
- 8540459041545441604854988856176194876049741
- 24401413084510554423536544004606650836656321
- 48630936334643334101211481634882249463084001
- 53896648695167545631657574576486461961799681
- 79929124221529331502274195427290223331742141
- 188562163845850384482030300154603824662386561
- 4873738397513713778074934757543707314307340001
- 205753133602696292325676133512925929399023762961
- 166881226771712730402012036273874036332643600717681
- 2832301991199898344880319739243377178777932393009281
- 69151952950273521303030336106507193030327190205295772001
- 29302680383281339084821200381682446212968030489888602212801
- 24175535728373739778391915425385744974848129389282725172845441
|