Antiprime

Print a list of antiprimes (highly composite numbers) with bc

#! /usr/bin/bc
define factors(n) {
    auto c, i
    for(i=1;i<=n;i++) {
        if(n%i==0) c+=1
    }
    return c
}
max = 0
n = 1
for(c=19; c > 0;) {
    f = factors(n)
    if(f > max) {
        print n," "
        max = f
        c -= 1
    }
    n += 1
}
print "\n"
quit

Unknown's avatar

About Linuxgal

Need a spiritual home? Consider joining us at Mary Queen of the Universe Latter-day Buddhislamic Free Will Christian UFO Synagogue of Vishnu
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a comment