Jump to content

Truncatable primes: Difference between revisions

m
(Added C++ solution)
Line 985:
 
=={{header|Elena}}==
ELENA 45.x0 :
<lang elena>import system'calendarextensions;
import extensions;
 
const MAXN = 1000000;
Line 999 ⟶ 998:
if (n < 2) { ^ false };
if (n < 4) { ^ true };
if (n .mod:2 == 0) { ^ false };
if (n < 9) { ^ true };
if (n .mod:3 == 0) { ^ false };
int r := n.sqrt();
Line 1,052 ⟶ 1,051:
}
 
public program()
{
var n := MAXN;
Line 1,078 ⟶ 1,077:
console.printLine("Largest truncable left is ",max_lt);
console.printLine("Largest truncable right is ",max_rt);
console.readChar()
}</lang>
{{out}}
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.