How to resolve the algorithm Count in factors step by step in the EchoLisp programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Count in factors step by step in the EchoLisp programming language
Table of Contents
Problem Statement
Write a program which counts up from 1, displaying each number as the multiplication of its prime factors. For the purpose of this task, 1 (unity) may be shown as itself.
2 is prime, so it would be shown as itself. 6 is not prime; it would be shown as
2 × 3
{\displaystyle 2\times 3}
. 2144 is not prime; it would be shown as
2 × 2 × 2 × 2 × 2 × 67
{\displaystyle 2\times 2\times 2\times 2\times 2\times 67}
.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Count in factors step by step in the EchoLisp programming language
Source code in the echolisp programming language
(define (task (nfrom 2) (range 20))
(for ((i (in-range nfrom (+ nfrom range))))
(writeln i "=" (string-join (prime-factors i) " x "))))
You may also check:How to resolve the algorithm Empty program step by step in the Zoomscript programming language
You may also check:How to resolve the algorithm Unbias a random generator step by step in the Icon and Unicon programming language
You may also check:How to resolve the algorithm Tau number step by step in the APL programming language
You may also check:How to resolve the algorithm Strip comments from a string step by step in the Wren programming language
You may also check:How to resolve the algorithm Arithmetic/Integer step by step in the Nanoquery programming language