Additive primes: Difference between revisions
m
syntax highlighting fixup automation
Langurmonkey (talk | contribs) m (→{{header|langur}}: added langur rev. no.) |
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
||
Line 21:
{{trans|Python}}
<
I a == 2
R 1B
Line 43:
additive_primes++
print(i, end' ‘ ’)
print("\nFound "additive_primes‘ additive primes less than 500’)</
{{out}}
Line 52:
=={{header|AArch64 Assembly}}==
{{works with|as|Raspberry Pi 3B version Buster 64 bits <br> or android 64 bits with application Termux }}
<
/* ARM assembly AARCH64 Raspberry PI 3B or android 64 bits */
/* program additivePrime64.s */
Line 202:
.include "../includeARM64.inc"
</syntaxhighlight>
<pre>
Prime : 2
Line 261:
</pre>
=={{header|Ada}}==
<
procedure Additive_Primes is
Line 318:
Put (" additive primes.");
New_Line;
end Additive_Primes;</
{{out}}
<pre>Additive primes <500:
Line 330:
=={{header|ALGOL 68}}==
{{libheader|ALGOL 68-primes}}
<
# sieve the primes to max prime #
PR read "primes.incl.a68" PR
Line 353:
OD;
print( ( newline, "Found ", whole( additive count, 0 ), " additive primes below ", whole( UPB prime + 1, 0 ), newline ) )
END</
{{out}}
<pre>
Line 363:
=={{header|ALGOL W}}==
<
% sets p( 1 :: n ) to a sieve of primes up to n %
procedure Eratosthenes ( logical array p( * ) ; integer value n ) ;
Line 402:
write( i_w := 1, s_w := 0, "Found ", aCount, " additive primes below ", MAX_NUMBER )
end
end.</
{{out}}
<pre>
Line 413:
=={{header|APL}}==
<
{{out}}
Line 421:
=={{header|AppleScript}}==
<
script o
property numberList : {missing value}
Line 466:
-- Task code:
tell additivePrimes(499) to return {|additivePrimes<500|:it, numberThereof:count}</
{{output}}
<
=={{header|ARM Assembly}}==
{{works with|as|Raspberry Pi <br> or android 32 bits with application Termux}}
<
/* ARM assembly Raspberry PI */
/* program additivePrime.s */
Line 618:
.include "../affichage.inc"
</syntaxhighlight>
<pre>
Prime : 2
Line 678:
=={{header|Arturo}}==
<
loop split.every:10 additives 'a ->
print map a => [pad to :string & 4]
print ["\nFound" size additives "additive primes up to 500"]</
{{out}}
Line 697:
=={{header|AWK}}==
<
# syntax: GAWK -f ADDITIVE_PRIMES.AWK
BEGIN {
Line 727:
return(sum)
}
</syntaxhighlight>
{{out}}
<pre>
Line 740:
=={{header|BASIC}}==
<
20 DIM P(E): P(0)=-1: P(1)=-1
30 FOR I=2 TO SQR(E)
Line 750:
90 IF NOT P(S) THEN N=N+1: PRINT I,
100 NEXT
110 PRINT: PRINT N;" additive primes found below ";E</
{{out}}
<pre> 2 3 5 7 11
Line 765:
54 additive primes found below 500</pre>
==={{header|Applesoft BASIC}}===
<
1 F = E - 1:L = LEN ( STR$ (F)) + 1: FOR I = 2 TO L:S$ = S$ + CHR$ (32): NEXT I: DIM P(E):P(0) = - 1:P(1) = - 1: FOR I = 2 TO SQR (F): IF NOT P(I) THEN FOR J = I * 2 TO E STEP I:P(J) = - 1: NEXT J
2 NEXT I: FOR I = B TO F: IF NOT P(I) THEN GOSUB 4
Line 771:
4 S = 0: IF I THEN FOR J = I TO 0 STEP 0:J1 = INT (J / 10):S = S + (J - J1 * 10):J = J1: NEXT J
5 IF NOT P(S) THEN N = N + 1: PRINT RIGHT$ (S$ + STR$ (I),L);
6 RETURN</
<pre>
2 3 5 7 11 23 29 41 43 47 61 67 83 89 101 113 131 137 139 151 157 173 179 191 193 197 199 223 227 229 241 263 269 281 283 311 313 317 331 337 353 359 373 379 397 401 409 421 443 449 461 463 467 487
Line 778:
=={{header|BASIC256}}==
<
for i = 2 to 499
if isprime(i) then
Line 805:
end while
return s
end function</
=={{header|BCPL}}==
<
manifest $( limit = 500 $)
Line 842:
$)
writef("*N*NFound %N additive primes < %N.*N", num, limit)
$)</
{{out}}
<pre> 2 3 5 7 11 23 29 41 43 47
Line 854:
=={{header|C}}==
<syntaxhighlight lang=C>
#include <stdbool.h>
#include <stdio.h>
Line 928:
return 0;
}/* main */
</syntaxhighlight>
{{out}}
<pre>
Line 942:
=={{header|C++}}==
<
#include <iostream>
Line 983:
}
std::cout << '\n' << count << " additive primes found.\n";
}</
{{out}}
Line 999:
=={{header|CLU}}==
<
% Returns an array [1..max] marking the primes
sieve = proc (max: int) returns (array[bool])
Line 1,041:
stream$putl(po, "\nFound " || int$unparse(count) ||
" additive primes < " || int$unparse(max))
end start_up</
{{out}}
<pre> 2 3 5 7 11 23 29 41 43 47
Line 1,052:
=={{header|COBOL}}==
<
PROGRAM-ID. ADDITIVE-PRIMES.
Line 1,124:
SIEVE-INNER-LOOP.
MOVE 'X' TO COMPOSITE-FLAG(SIEVE-COMP).</
{{out}}
<pre> 2 3 5 7 11 23 29 41 43 47
Line 1,136:
=={{header|Common Lisp}}==
<
(defun sum-of-digits (n)
"Return the sum of the digits of a number"
Line 1,158:
</syntaxhighlight>
{{out}}<pre>(dotimes (i 500) (when (additive-primep i) (princ i) (princ " ")))
Line 1,165:
=={{header|Crystal}}==
<
# Uses P3 Prime Generator (PG) and its Prime Generator Sequence (PGS).
Line 1,203:
addprimes.each_with_index { |n, idx| printf "%*d ", maxdigits, n; print "\n" if idx % 10 == 9 } # more efficient
puts "\n#{addprimes.size} additive primes below #{nn}."
</syntaxhighlight>
{{out}}
<pre> 2 3 5 7 11 23 29 41 43 47
Line 1,255:
=={{header|Draco}}==
<
word max, p, c;
max := dim(prime,1)-1;
Line 1,294:
writeln();
writeln("There are ", n, " additive primes below ", MAX)
corp</
{{out}}
<pre> 2 3 5 7 11 23 29 41 43 47 61 67 83 89 101 113 131 137 139 151
Line 1,302:
=={{header|Erlang}}==
<
main(_) ->
AddPrimes = [N || N <- lists:seq(2,500), isprime(N) andalso isprime(digitsum(N))],
Line 1,319:
digitsum(0, S) -> S;
digitsum(N, S) -> digitsum(N div 10, S + N rem 10).
</syntaxhighlight>
{{Out}}
<pre>
Line 1,332:
=={{header|F_Sharp|F#}}==
This task uses [http://www.rosettacode.org/wiki/Extensible_prime_generator#The_functions Extensible Prime Generator (F#)]
<
// Additive Primes. Nigel Galloway: March 22nd., 2021
let rec fN g=function n when n<10->n+g |n->fN(g+n%10)(n/10)
primes32()|>Seq.takeWhile((>)500)|>Seq.filter(fN 0>>isPrime)|>Seq.iter(printf "%d "); printfn ""
</syntaxhighlight>
{{out}}
<pre>
Line 1,344:
=={{header|Factor}}==
{{works with|Factor|0.99 2021-02-05}}
<
prettyprint sequences ;
Line 1,352:
499 primes-upto [ sum-digits prime? ] filter
[ 9 group simple-table. nl ]
[ length "Found %d additive primes < 500.\n" printf ] bi</
{{out}}
<pre>
Line 1,366:
=={{header|Fermat}}==
<
digsum := 0;
while n>0 do
Line 1,383:
fi od;
!!('There were ',nadd);</
{{out}}<pre>
Additive primes below 500 are
Line 1,444:
=={{header|Forth}}==
{{works with|Gforth}}
<
: notprime! ( n -- ) here + 1 swap c! ;
Line 1,483:
500 print_additive_primes
bye</
{{out}}
Line 1,499:
=={{header|FreeBASIC}}==
As with the other special primes tasks, use one of the primality testing algorithms as an include.
<
function digsum( n as uinteger ) as uinteger
Line 1,520:
end if
end if
next i</
{{out}}
<pre style="height:16em">Prime Digit Sum
Line 1,582:
then go through the list, sum digits and check for prime
<
Program AdditivePrimes;
Const max_number = 500;
Line 1,644:
writeln(counter,' additive primes found.');
End.
</syntaxhighlight>
{{out}}
<pre>
Line 1,658:
=={{header|Frink}}==
<
println[formatTable[columnize[vals, 10]]]
println["\n" + length[vals] + " values found."]</
{{out}}
<pre>
Line 1,674:
=={{header|Go}}==
<
import "fmt"
Line 1,733:
}
fmt.Printf("\n\n%d additive primes found.\n", count)
}</
{{out}}
Line 1,749:
=={{header|J}}==
<
2 3 5 7 11 23 29 41 43 47 61 67 83 89 101 113 131 137 139 151 157 173 179 191 193 197 199 223 227 229 241 263 269 281 283 311 313 317 331 337 353 359 373 379 397 401 409 421 443 449 461 463 467 487</
=={{header|Java}}==
<
public static void main(String[] args) {
Line 1,789:
}
}
</syntaxhighlight>
{{out}}
Line 1,800:
'''Preliminaries'''
<
. as $n
| if ($n < 2) then false
Line 1,832:
def lpad($len): tostring | ($len - length) as $l | (" " * $l)[:$l] + .;
</syntaxhighlight>
'''The task'''
<syntaxhighlight lang=jq>
# Input: a number n
# Output: an array of additive primes less than n
Line 1,851:
| ((nwise(10) | map(lpad(4)) | join(" ")),
"\n\(length) additive primes found."))
</
{{out}}
<pre>
Line 1,867:
=={{header|Haskell}}==
Naive solution which doesn't rely on advanced number theoretic libraries.
<
-- infinite list of primes
Line 1,884:
-- test for an additive prime
isAdditivePrime n = isPrime n && (isPrime . sum . digits) n
</syntaxhighlight>
The task
Line 1,903:
=={{header|Julia}}==
<
let
Line 1,917:
println("\n\n$pcount additive primes found.")
end
</
<pre>
Erdős primes under 500:
Line 1,929:
=={{header|Kotlin}}==
{{trans|Python}}
<
if (n <= 3) return n > 1
if (n % 2 == 0 || n % 3 == 0) return false
Line 1,959:
}
println("\nFound $additivePrimes additive primes less than 500")
}</
{{out}}
<pre>2 3 5 7 11 23 29 41 43 47 61 67 83 89 101 113 131 137 139 151 157 173 179 191 193 197 199 223 227 229 241 263 269 281 283 311 313 317 331 337 353 359 373 379 397 401 409 421 443 449 461 463 467 487
Line 1,965:
=={{header|Ksh}}==
<
# Prime numbers for which the sum of their decimal digits are also primes
Line 2,011:
_isprime ${digsum} ; (( $? )) && printf "%4d " ${i}
done
print</
{{out}}
<pre> 2 3 5 7 11 23 29 41 43 47 61 67 83 89 101 113 131 137 139 151 157 173 179 191 193 197 199 223 227 229 241 263 269 281 283 311 313 317 331 337 353 359 373 379 397 401 409 421 443 449 461 463 467 487 </pre>
Line 2,018:
=={{header|langur}}==
{{works with|langur|0.10}}
<
val .sumDigits = f fold f{+}, s2n toString .i
Line 2,035:
writeln $"\n\n\.count; additive primes found.\n"
</syntaxhighlight>
{{out}}
Line 2,051:
=={{header|Lua}}==
This task uses <code>primegen</code> from: [[Extensible_prime_generator#Lua]]
<
local sum = 0
while n > 0 do
Line 2,063:
aprimes = primegen:filter(function(n) return primegen.tbd(sumdigits(n)) end)
print(table.concat(aprimes, " "))
print("Count:", #aprimes)</
{{out}}
<pre>2 3 5 7 11 23 29 41 43 47 61 67 83 89 101 113 131 137 139 151 157 173 179 191 193 197 199 223 227 229 241 263 269 281 283 311 313 317 331 337 353 359 373 379 397 401 409 421 443 449 461 463 467 487
Line 2,069:
=={{header|Mathematica}}/{{header|Wolfram Language}}==
<
AdditivePrimeQ[n_Integer] := PrimeQ[n] \[And] PrimeQ[Total[IntegerDigits[n]]]
Select[Range[500], AdditivePrimeQ]</
{{out}}
<pre>{2,3,5,7,11,23,29,41,43,47,61,67,83,89,101,113,131,137,139,151,157,173,179,191,193,197,199,223,227,229,241,263,269,281,283,311,313,317,331,337,353,359,373,379,397,401,409,421,443,449,461,463,467,487}</pre>
=={{header|Modula-2}}==
<
FROM InOut IMPORT WriteString, WriteCard, WriteLn;
Line 2,129:
WriteString('.');
WriteLn();
END AdditivePrimes.</
{{out}}
<pre> 2 3 5 7 11 23 29 41 43 47
Line 2,140:
=={{header|Nim}}==
<
const N = 499
Line 2,170:
echo()
echo "\nNumber of additive primes found: ", count</
{{out}}
Line 2,185:
=={{header|Pari/GP}}==
This is a good task for demonstrating several different ways to approach a simple problem.
<
v1 = select(isprime, select(hasPrimeDigitsum, [1..499]));
Line 2,192:
s=0; forprime(p=2,499, if(hasPrimeDigitsum(p), s++)); s;
[#v1, #v2, #v3, s]</
{{out}}
<pre>%1 = [54, 54, 54, 54]</pre>
=={{header|Pascal}}==
{{works with|Free Pascal}}{{works with|Delphi}} checking isPrime(sum of digits) before testimg isprime(num) improves speed.<br>Tried to speed up calculation of sum of digits.
<
{$IFDEF FPC}
{$MODE DELPHI}{$CODEALIGN proc=16}
Line 2,345:
writeln(cnt, ' additive primes found.');
END.
</syntaxhighlight>
{{out}}
<pre>
Line 2,360:
=={{header|Perl}}==
{{libheader|ntheory}}
<
use warnings;
use ntheory 'is_prime';
Line 2,374:
is_prime($_) and is_prime(sum(split '',$_)) and push @ap, $_ for 1..$limit;
print @ap . " additive primes < $limit:\n" . pp(@ap);</
{{out}}
<pre>54 additive primes < 500:
Line 2,383:
=={{header|Phix}}==
<!--<
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #008080;">function</span> <span style="color: #000000;">additive</span><span style="color: #0000FF;">(</span><span style="color: #004080;">string</span> <span style="color: #000000;">p</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">return</span> <span style="color: #7060A8;">is_prime</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">sum</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">sq_sub</span><span style="color: #0000FF;">(</span><span style="color: #000000;">p</span><span style="color: #0000FF;">,</span><span style="color: #008000;">'0'</span><span style="color: #0000FF;">)))</span> <span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
<span style="color: #004080;">sequence</span> <span style="color: #000000;">res</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">filter</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">apply</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">get_primes_le</span><span style="color: #0000FF;">(</span><span style="color: #000000;">500</span><span style="color: #0000FF;">),</span><span style="color: #7060A8;">sprint</span><span style="color: #0000FF;">),</span><span style="color: #000000;">additive</span><span style="color: #0000FF;">)</span>
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"%d additive primes found: %s\n"</span><span style="color: #0000FF;">,{</span><span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">res</span><span style="color: #0000FF;">),</span><span style="color: #7060A8;">join</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">shorten</span><span style="color: #0000FF;">(</span><span style="color: #000000;">res</span><span style="color: #0000FF;">,</span><span style="color: #008000;">""</span><span style="color: #0000FF;">,</span><span style="color: #000000;">6</span><span style="color: #0000FF;">))})</span>
<!--</
{{out}}
<pre>
Line 2,395:
=={{header|Phixmonti}}==
<
by Galileo, 05/2022 #/
Line 2,421:
"Additive primes found: " print print
</syntaxhighlight>
{{out}}
<pre>2 3 5 7 11 23 29 41 43 47 61 67 83 89 101 113 131 137 139 151 157 173 179 191 193 197 199 223 227 229 241 263 269 281 283 311 313 317 331 337 353 359 373 379 397 401 409 421 443 449 461 463 467 487 Additive primes found: 54
Line 2,427:
=={{header|Picat}}==
<
PCount = 0,
foreach (I in 2..499)
Line 2,439:
sum_digits(N) = S =>
S = sum([ord(C)-ord('0') : C in to_string(N)]).
</syntaxhighlight>
{{out}}
Line 2,449:
=={{header|PicoLisp}}==
<
(let D 0
(or
Line 2,469:
(inc 'C) ) )
(prinl)
(prinl "Total count: " C) )</
{{out}}
<pre>
Line 2,477:
=={{header|PILOT}}==
<
:c=0
:max=500
Line 2,519:
:i=j
J (i>0):*digit
E :</
{{out}}
<pre style='height:50ex;'>2
Line 2,589:
The PL/I include file "pg.inc" can be found on the [[Polyglot:PL/I and PL/M]] page.
Note the use of text in column 81 onwards to hide the PL/I specifics from the PL/M compiler.
<
additive_primes_100H: procedure options (main);
Line 2,676:
CALL PRNL;
EOF: end additive_primes_100H;</
{{out}}
<pre>
Line 2,688:
=={{header|Processing}}==
<
void setup() {
Line 2,723:
}
}
}</
{{out}}
<pre>2 3 5 7 11 23 29 41 43 47 61 67 83 89 101 113 131 137 139 151 157 173 179 191 193 197 199 223 227 229 241 263 269 281 283 311 313 317 331 337 353 359 373 379 397 401 409 421 443 449 461 463 467 487
Line 2,729:
=={{header|PureBasic}}==
<
Global Dim P.b(#MAX) : FillMemory(@P(),#MAX,1,#PB_Byte)
If OpenConsole()=0 : End 1 : EndIf
Line 2,743:
Next
PrintN(~"\n\n"+Str(c)+" additive primes below 500.")
Input()</
{{out}}
<pre> 2 3 5 7 11 23 29 41 43 47
Line 2,755:
=={{header|Python}}==
<
if n <= 3:
return n > 1
Line 2,783:
if __name__ == "__main__":
main()</
{{out}}
<pre>2 3 5 7 11 23 29 41 43 47 61 67 83 89 101 113 131 137 139 151 157 173 179 191 193 197 199 223 227 229 241 263 269 281 283 311 313 317 331 337 353 359 373 379 397 401 409 421 443 449 461 463 467 487
Line 2,794:
<code>digitsum</code> is defined at [[Sum digits of an integer#Quackery]].
<
[]
Line 2,803:
[ i^ join ] ] ]
dup echo cr cr
size echo say " additive primes found."</
{{out}}
Line 2,814:
=={{header|Racket}}==
<
(require math/number-theory)
Line 2,827:
(define additive-primes<500 (filter additive-prime? (range 1 500)))
(printf "There are ~a additive primes < 500~%" (length additive-primes<500))
(printf "They are: ~a~%" additive-primes<500)</
{{out}}
Line 2,835:
=={{header|Raku}}==
<
say "{+$_} additive primes < $limit:\n{$_».fmt("%" ~ $limit.chars ~ "d").batch(10).join("\n")}",
with ^$limit .grep: { .is-prime and .comb.sum.is-prime }</
{{out}}
<pre>54 additive primes < 500:
Line 2,848:
=={{header|Red}}==
<
cross-sum: function [n][out: 0 foreach m form n [out: out + to-integer to-string m]]
additive-primes: function [n][collect [foreach p ps: primes n [if find ps cross-sum p [keep p]]]]
Line 2,862:
]
== 54
</syntaxhighlight>
Uses <code>primes</code> defined in https://rosettacode.org/wiki/Sieve_of_Eratosthenes#Red.
=={{header|REXX}}==
<
parse arg n cols . /*get optional number of primes to find*/
if n=='' | n=="," then n= 500 /*Not specified? Then assume default.*/
Line 2,909:
end /*k*/ /* [↑] only divide up to √ J */
#= # + 1; @.#= j; sq.#= j*j; !.j= 1 /*bump prime count; assign prime & flag*/
end /*j*/; return</
{{out|output|text= when using the default inputs:}}
<pre>
Line 2,926:
=={{header|Ring}}==
<
load "stdlib.ring"
Line 2,954:
see nl + "found " + row + " additive primes." + nl
see "done..." + nl
</syntaxhighlight>
{{out}}
<pre>
Line 2,969:
</pre>
=={{header|Ruby}}==
<
additive_primes = Prime.lazy.select{|prime| prime.digits.sum.prime? }
Line 2,977:
puts res.join(" ")
puts "\n#{res.size} additive primes below #{N}."
</syntaxhighlight>
{{out}}
<pre>2 3 5 7 11 23 29 41 43 47 61 67 83 89 101 113 131 137 139 151 157 173 179 191 193 197 199 223 227 229 241 263 269 281 283 311 313 317 331 337 353 359 373 379 397 401 409 421 443 449 461 463 467 487
Line 2,988:
===Flat implementation===
<
let limit = 500;
let column_w = limit.to_string().len() + 1;
Line 3,004:
}
println!("\n---\nFound {count} additive primes less than {limit}");
}</
{{out}}
<pre>
Line 3,020:
primal implements the sieve of Eratosthenes with optimizations (10+ times faster for large limits)
<
// primal = "0.3.0"
Line 3,038:
.count();
println!("\n---\nFound {count} additive primes less than {limit}");
}</
{{out}}
<pre>
Line 3,053:
=={{header|Sage}}==
<
limit = 500
additivePrimes = list(filter(lambda x: x > 0,
Line 3,059:
list(map(str,list(primes(1,limit))))))))
print(f"{additivePrimes}\nFound {len(additivePrimes)} additive primes less than {limit}")
</syntaxhighlight>
{{out}}
<pre>
Line 3,066:
</pre>
=={{header|Seed7}}==
<
const func boolean: isPrime (in integer: number) is func
Line 3,111:
end for;
writeln("\nFound " <& count <& " additive primes < 500.");
end func;</
{{out}}
<pre>
Line 3,125:
=={{header|Sidef}}==
<
upto.primes.grep { .sumdigits(base).is_prime }
}
Line 3,131:
additive_primes(500).each_slice(10, {|*a|
a.map { '%3s' % _ }.join(' ').say
})</
{{out}}
<pre>
Line 3,143:
=={{header|TSE SAL}}==
<
INTEGER PROC FNMathGetSquareRootI( INTEGER xI )
Line 3,253:
END
</syntaxhighlight>
{{out}} <pre>
Line 3,315:
=={{header|Swift}}==
<
func isPrime(_ n: Int) -> Bool {
Line 3,360:
}
}
print("\n\(count) additive primes found.")</
{{out}}
Line 3,410:
a@ = a@ / 10
loop
return (b@)</
{{Out}}
<pre>Prime Digit Sum
Line 3,471:
=={{header|Vlang}}==
{{trans|go}}
<
if n < 2 {
return false
Line 3,526:
}
println("\n\n$count additive primes found.")
}</
{{out}}
Line 3,542:
=={{header|VTL-2}}==
<
20 :1)=1
30 P=2
Line 3,575:
330 ?=N
340 ?=" additive primes below ";
350 ?=M+1</
{{out}}
<pre>2 3 5 7 11 23 29 41 43 47
Line 3,588:
{{libheader|Wren-math}}
{{libheader|Wren-fmt}}
<
import "/fmt" for Fmt
Line 3,610:
}
}
System.print("\n\n%(count) additive primes found.")</
{{out}}
Line 3,626:
=={{header|XPL0}}==
<
int N, I;
[if N <= 1 then return false;
Line 3,655:
Text(0, " additive primes found below 500.
");
]</
{{out}}
Line 3,669:
=={{header|Yabasic}}==
<
// by Galileo, 06/2022
Line 3,696:
next
print "\nFound: ", count</
{{out}}
<pre>2 3 5 7 11 23 29 41 43 47 61 67 83 89 101 113 131 137 139 151 157 173 179 191 193 197 199 223 227 229 241 263 269 281 283 311 313 317 331 337 353 359 373 379 397 401 409 421 443 449 461 463 467 487
|