How to resolve the algorithm Largest proper divisor of n step by step in the Nim programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Largest proper divisor of n step by step in the Nim programming language
Table of Contents
Problem Statement
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Largest proper divisor of n step by step in the Nim programming language
Source code in the nim programming language
import math, strutils
func largestProperDivisor(n: Positive): int =
for d in 2..sqrt(float(n)).int:
if n mod d == 0: return n div d
result = 1
for n in 1..100:
stdout.write ($n.largestProperDivisor).align(2), if n mod 10 == 0: '\n' else: ' '
You may also check:How to resolve the algorithm Fusc sequence step by step in the BQN programming language
You may also check:How to resolve the algorithm User input/Text step by step in the Io programming language
You may also check:How to resolve the algorithm Hello world/Web server step by step in the J programming language
You may also check:How to resolve the algorithm Tokenize a string step by step in the Arturo programming language
You may also check:How to resolve the algorithm Sierpinski carpet step by step in the Delphi programming language