Prime words: Difference between revisions

→‎{{header|Raku}}: Get all of the ridiculousness out there so we don't have to see any more of these tasks
m (→‎{{header|Raku}}: add another variation)
(→‎{{header|Raku}}: Get all of the ridiculousness out there so we don't have to see any more of these tasks)
Line 257:
 
say 'Number of words whose ords are all prime: ',
@words.hyper.grep({ all(.comb.».ord).is-prime }).&{display +$_, $_, ''};
 
say "\nNumber of words whose ordinal sum is prime: ",
@words.grep({ .comb».ord.sum.is-prime }).&{display +$_, .head(20)};
 
say "\nNumber of words whose ords are all prime, and whose ordinal sum is prime: ",
@words.hyper.grep({ all(.comb».ord).is-prime && .comb».ord.sum.is-prime }).&{display +$_, $_, ''};
 
say "\n\nInterpreting the words as if they were base 36 numbers:";
Line 272 ⟶ 275:
say "\nNumber of words whose base 36 digital sum is prime: ",
@words.grep({ !.contains(/\W/) && .comb».parse-base(36).sum.is-prime }).&{display +$_, .head(20)};
 
say "\nNumber of words that are prime in base 36, whose digits are all prime, and whose digital sum is prime: ",
@words.hyper.grep({ !.contains(/\W/) && all(.comb».parse-base(36)).is-prime && :36($_).is-prime && .comb».parse-base(36).sum.is-prime }).&{display +$_, $_, ''};
 
use Base::Any:ver<0.1.2+>;
Line 285 ⟶ 291:
 
say "\nNumber of words whose digital sum is prime using a custom base 26: ",
@words.grep({ !.contains(/<-alpha>/) && .comb».&from-base(26).sum.is-prime }).&{display +$_, .head(20)};</lang>
 
say "\nNumber of words that are prime in custom base 26, whose digits are all prime, and whose digital sum is prime: ",
@words.hyper.grep({ !.contains(/<-alpha>/) && all(.comb».&from-base(26)).is-prime && .&from-base(26).is-prime && .comb».&from-base(26).sum.is-prime }).&{display +$_, $_, ''};</lang>
{{out}}
<pre>Number of words whose ords are all prime: 36;
Line 292 ⟶ 301:
Number of words whose ordinal sum is prime: 3778;
First 20: 10th, 9th, a, a's, aau, ababa, abate, abhorred, abject, ablate, aboard, abrade, abroad, absentee, absentia, absolute, absorptive, absurd, abusive, accelerate
 
Number of words whose ords are all prime, and whose ordinal sum is prime: 12;
a, e, egg, g, gem, k, keg, m, mae, mamma, meg, q
 
 
Line 304 ⟶ 316:
Number of words whose base 36 digital sum is prime: 4740;
First 20: 10th, 3rd, 7th, aba, abacus, abalone, abase, abater, abelian, abelson, aberrant, abeyant, ablaze, abort, aboveground, abraham, abrasion, abrasive, abreact, abridge
 
Number of words that are prime in base 36, whose digits are all prime, and whose digital sum is prime: 8;
7th, b, d, h, j, n, t, v
 
 
Line 315 ⟶ 330:
 
Number of words whose digital sum is prime using a custom base 26: 5473;
First 20: ababa, aback, abacus, abalone, abase, abater, abc, abdicate, abdomen, abe, abelian, abelson, aberrant, abeyant, ablaze, abolish, abominate, aborigine, aboveground, abraham</pre>
 
Number of words that are prime in custom base 26, whose digits are all prime, and whose digital sum is prime: 9;
c, d, f, h, l, n, r, t, x</pre>
 
=={{header|REXX}}==
10,327

edits