Jump to content

Abundant odd numbers: Difference between revisions

m
Line 186:
prettyprintfactors(n) = (a = propfact(n); println("$n has proper divisors $a, these sum to $(sum(a))."))
 
function oddabundantsfrom(startingint, needed, nprint=0, targetf=(x -> false))
n = isodd(startingint) ? startingint : startingint + 1
count = 0
Line 194:
prettyprintfactors(n)
end
if targetf(n) || nprint == count + 1
prettyprintfactors(n)
break
Line 211:
 
println("The first abundant odd number greater than one billion:")
oddabundantsfrom(21000000000, 1000000000000, -1, x -> x > 10000000000)
</lang>{{out}}
<pre>
4,105

edits

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