Jump to content

Chowla numbers: Difference between revisions

(Added Algol 68)
Line 4,700:
{{libheader|Wren-fmt}}
{{libheader|Wren-math}}
<lang ecmascript>import "./fmt" for Fmt
import "./math" for Int, Nums
 
var chowla = Fn.new { |n| (n > 1) ? Nums.sum(Int.properDivisors(n)) - 1 : 0 }
 
for (i in 1..37) SystemFmt.print("chowla(%(Fmt.$2d) = $d(2", i))), = %(chowla.call(i))")
System.print()
var count = 1
Line 4,715:
if (!c[i]) count = count + 1
if (i == power - 1) {
SystemFmt.print("Count of primes up to %(Fmt.dc($,-10, power))10d = %(Fmt.dc(0$,d", power, count))")
power = power * 10
}
Line 4,728:
if (p > limit) break
if (chowla.call(p) == p-1) {
SystemFmt.print("%(Fmt.dc(0$, p))d is a perfect number", p)
count = count + 1
}
9,485

edits

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