Multiplicatively perfect numbers

Revision as of 17:02, 17 April 2023 by CalmoSoft (talk | contribs) (Created page with "Definition <br><br> If the product of the divisors of an integer n (other than 1 and n itself) is equal to the number itself, then n is a special number. <br> Task <br> Find and show on this page the Special numbers where n < 500 <br> =={{header|Ring}}== <syntaxhighlight lang="ring"> see "working..." + nl limit = 500 Divisors = [] for n = 1 to limit pro = 1 Divisors = [] for m = 2 to ceil(sqrt(n))+1 if n % m = 0 pro = pro * m ad...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Definition

If the product of the divisors of an integer n (other than 1 and n itself) is equal to the number itself, then n is a special number.
Task
Find and show on this page the Special numbers where n < 500

Ring

see "working..." + nl
limit = 500
Divisors = []
for n = 1 to limit
    pro = 1
    Divisors = []
    for m = 2 to ceil(sqrt(n))+1
        if n % m = 0
           pro = pro * m
           add(Divisors,m)
        ok
    next
    str = ""
    if n = pro and len(Divisors) > 1
       for m = 1 to len(Divisors)
           str = str + Divisors[m] + ", "
           if m = len(Divisors)
              str = left(str,len(str)-2) + "]"
           ok
       next
       see "n = " + n + "  divisors = " + "[" + str + "  product = " + pro + nl
    ok
next
see "done..." + nl
Output:
working...
n = 6  divisors = [2, 3]  product = 6
n = 8  divisors = [2, 4]  product = 8
n = 10  divisors = [2, 5]  product = 10
n = 15  divisors = [3, 5]  product = 15
n = 35  divisors = [5, 7]  product = 35
n = 64  divisors = [2, 4, 8]  product = 64
n = 105  divisors = [3, 5, 7]  product = 105
n = 135  divisors = [3, 5, 9]  product = 135
n = 143  divisors = [11, 13]  product = 143
n = 165  divisors = [3, 5, 11]  product = 165
n = 189  divisors = [3, 7, 9]  product = 189
n = 231  divisors = [3, 7, 11]  product = 231
n = 273  divisors = [3, 7, 13]  product = 273
n = 286  divisors = [2, 11, 13]  product = 286
n = 297  divisors = [3, 9, 11]  product = 297
n = 323  divisors = [17, 19]  product = 323
n = 351  divisors = [3, 9, 13]  product = 351
n = 357  divisors = [3, 7, 17]  product = 357
n = 374  divisors = [2, 11, 17]  product = 374
n = 385  divisors = [5, 7, 11]  product = 385
n = 429  divisors = [3, 11, 13]  product = 429
n = 442  divisors = [2, 13, 17]  product = 442
n = 455  divisors = [5, 7, 13]  product = 455
n = 459  divisors = [3, 9, 17]  product = 459
n = 494  divisors = [2, 13, 19]  product = 494
done...