Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/Additive-primes/Langur/additive-primes.langur
Normal file
17
Task/Additive-primes/Langur/additive-primes.langur
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
val .isPrime = f .i == 2 or .i > 2 and not any f(.x) .i div .x, pseries 2 .. .i ^/ 2
|
||||
|
||||
val .sumDigits = f fold f{+}, s2n toString .i
|
||||
|
||||
writeln "Additive primes less than 500:"
|
||||
|
||||
var .count = 0
|
||||
|
||||
for .i in [2] ~ series(3..500, 2) {
|
||||
if .isPrime(.i) and .isPrime(.sumDigits(.i)) {
|
||||
write $"\.i:3; "
|
||||
.count += 1
|
||||
if .count div 10: writeln()
|
||||
}
|
||||
}
|
||||
|
||||
writeln $"\n\n\.count; additive primes found.\n"
|
||||
Loading…
Add table
Add a link
Reference in a new issue