Jump to content

Deceptive numbers: Difference between revisions

 
Line 761:
=={{header|langur}}==
{{trans|ALGOL 68}}
<syntaxhighlight lang="langur">val .isPrime = fn(.i) {
val isPrime = fn(i) {
.i == 2 or .i > 2 and
not any(fn fn(.x): { .i div .x }, pseries (2 .. .i ^/ 2))
}
 
var .nums = []
var .repunit = 111_111
 
for .n = 9; len(.nums) < 10; .n += 2 {
.repunit = .repunit * 100 + 11
if not .isPrime(.n) and .repunit div .n {
.nums = more .(nums, .n)
}
}
 
writeln .nums
</syntaxhighlight>
 
990

edits

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