How to resolve the algorithm Proper divisors step by step in the 11l programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Proper divisors step by step in the 11l programming language

Table of Contents

Problem Statement

The   proper divisors   of a positive integer N are those numbers, other than N itself, that divide N without remainder. For N > 1 they will always include 1,   but for N == 1 there are no proper divisors.

The proper divisors of     6     are   1, 2, and 3. The proper divisors of   100   are   1, 2, 4, 5, 10, 20, 25, and 50.

Show all output here.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Proper divisors step by step in the 11l programming language

Source code in the 11l programming language

F proper_divs(n)
   R Array(Set((1 .. (n + 1) I/ 2).filter(x -> @n % x == 0 & @n != x)))

print((1..10).map(n -> proper_divs(n)))

V (n, leng) = max(((1..20000).map(n -> (n, proper_divs(n).len))), key' pd -> pd[1])
print(n‘ ’leng)

  

You may also check:How to resolve the algorithm Ordered words step by step in the Liberty BASIC programming language
You may also check:How to resolve the algorithm Remove duplicate elements step by step in the Ruby programming language
You may also check:How to resolve the algorithm Prime conspiracy step by step in the Elixir programming language
You may also check:How to resolve the algorithm Boolean values step by step in the Haskell programming language
You may also check:How to resolve the algorithm Loops/Break step by step in the E programming language