Jump to content

Semiprime: Difference between revisions

→‎{{header|Euler}}: "syntax highlighting"
(Added Euler)
(→‎{{header|Euler}}: "syntax highlighting")
Line 1,241:
=={{header|Euler}}==
{{Trans|C++}}
<!-- syntaxhighlight lang="euler"> -->
'''begin''' '''new''' isSemiPrime; '''new''' x; '''label''' xLoop;
isSemiPrime <-
 
isSemiPrime <- ` '''formal''' v;
'''begin''' '''new''' a; '''new''' b; '''new''' c; '''label''' again;
` formal v;
begin new a; new<- b2; newb c<- 0; labelc <- againv;
again: '''if''' ab <- 2;3 b'''and''' <-c 0;> c1 <-'''then''' v;'''begin'''
again: if b < 3 and '''if''' c >'''mod''' 1a = 0 '''then''' '''begin'''
if c mod a =c 0<- thenc begin% a;
c b <- cb %+ a;1
b <- b + 1'''end'''
'''else''' a end<- a + 1;
else a'''goto''' <- a + 1;again
'''end''' '''else''' goto again0;
end elseb 0;= 2
b = 2'''end'''
end'
';
x <- 1;
xLoop: '''if''' [ x <- x + 1 ] < 100 '''then''' '''begin'''
x <- 1;
'''if''' isSemiPrime( x ) '''then''' '''out''' x '''else''' 0;
xLoop: if [ x <- x + 1 ] < 100 then begin
if isSemiPrime('''goto''' x ) then out x else 0;xLoop
'''end''' '''else''' goto xLoop0
'''end''' $ end else 0
<!-- </syntaxhighlight> -->
end $
</syntaxhighlight>
{{out}}
<pre>
3,044

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.