Pan base non-primes: Difference between revisions

Content added Content deleted
(New draft task and Raku example)
 
m (minor tweaks)
Line 26: Line 26:


'''"4"''' is ''not'' a prime in every base except bases 2, 3, and 4 where it is an invalid number (and hence not a prime there either.)
'''"4"''' is ''not'' a prime in every base except bases 2, 3, and 4 where it is an invalid number (and hence not a prime there either.)



In general, even pan-base non-primes are much more prevalent than odd, though both are fairly common.
In general, even pan-base non-primes are much more prevalent than odd, though both are fairly common.


With the exception of "10", numeric strings that end in 0 are composite in every base where they are valid.
With the exception of '''"10"''', numeric strings that end in 0 are composite in every base where they are valid.


Numeric strings where the greatest common divisor of all of the digits is more than 1 are composite in every base.
Numeric strings where the greatest common divisor of all of the digits is more than 1 are composite in every base.
Line 56: Line 57:


put "First 50 pan-base non-primes:\n" ~ @np[^50].batch(10)».fmt("%3s").join: "\n";
put "First 50 pan-base non-primes:\n" ~ @np[^50].batch(10)».fmt("%3s").join: "\n";
put "\nFirst 20 odd pan-base non-primes:\n" ~ @np.grep( * % 2 )[^20].batch(10)».fmt("%3s").join: "\n";
put "\nFirst 20 odd pan-base non-primes:\n" ~ @np.grep(* % 2)[^20].batch(10)».fmt("%3s").join: "\n";


my $threshold = 2500;
my $threshold = 2500;