properDivisors.frink

Download or view properDivisors.frink in plain text format


/** This is a solver for Rosetta Code problem:
    Proper Divisors
    https://rosettacode.org/wiki/Proper_divisors
*/


for n = 1 to 10
   println["$n\t" + join[" ", properDivisors[n]]]

println[]

d = new dict
for n = 1 to 20000
{
   c = length[properDivisors[n]]
   d.addToList[c, n]
}

most = max[keys[d]]
println[d@most + " have $most factors"]

properDivisors[n] := allFactors[n, true, false, true]


Download or view properDivisors.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 20217 days, 23 hours, 37 minutes ago.