Truncatable primes: Difference between revisions
Content added Content deleted
(Added C++ solution) |
|||
Line 985: | Line 985: | ||
=={{header|Elena}}== |
=={{header|Elena}}== |
||
ELENA |
ELENA 5.0 : |
||
<lang elena>import |
<lang elena>import extensions; |
||
import extensions; |
|||
const MAXN = 1000000; |
const MAXN = 1000000; |
||
Line 999: | Line 998: | ||
if (n < 2) { ^ false }; |
if (n < 2) { ^ false }; |
||
if (n < 4) { ^ true }; |
if (n < 4) { ^ true }; |
||
if (n |
if (n.mod:2 == 0) { ^ false }; |
||
if (n < 9) { ^ true }; |
if (n < 9) { ^ true }; |
||
if (n |
if (n.mod:3 == 0) { ^ false }; |
||
int r := n.sqrt(); |
int r := n.sqrt(); |
||
Line 1,052: | Line 1,051: | ||
} |
} |
||
program() |
public program() |
||
{ |
{ |
||
var n := MAXN; |
var n := MAXN; |
||
Line 1,078: | Line 1,077: | ||
console.printLine("Largest truncable left is ",max_lt); |
console.printLine("Largest truncable left is ",max_lt); |
||
console.printLine("Largest truncable right is ",max_rt); |
console.printLine("Largest truncable right is ",max_rt); |
||
console.readChar() |
|||
}</lang> |
}</lang> |
||
{{out}} |
{{out}} |