properDivisors.frink

View or download 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]


View or download 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 18868 days, 1 hours, 43 minutes ago.