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

Published on 12 May 2024 09:40 PM

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

Table of Contents

Problem Statement

A factorion is a natural number that equals the sum of the factorials of its digits.

145   is a factorion in base 10 because:

It can be shown (see talk page) that no factorion in base 10 can exceed   1,499,999.

Write a program in your language to demonstrate, by calculating and printing out the factorions, that:

Let's start with the solution:

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

Source code in the 11l programming language

V fact = [1]
L(n) 1..11
   fact.append(fact[n-1] * n)

L(b) 9..12
   print(‘The factorions for base ’b‘ are:’)
   L(i) 1..1'499'999
      V fact_sum = 0
      V j = i
      L j > 0
         V d = j % b
         fact_sum += fact[d]
         j I/= b
      I fact_sum == i
         print(i, end' ‘ ’)
   print("\n")

  

You may also check:How to resolve the algorithm Pentagram step by step in the Go programming language
You may also check:How to resolve the algorithm Pairs with common factors step by step in the Go programming language
You may also check:How to resolve the algorithm Hello world/Text step by step in the IBM Z HL/ASM programming language
You may also check:How to resolve the algorithm Towers of Hanoi step by step in the PHP programming language
You may also check:How to resolve the algorithm Identity matrix step by step in the Kotlin programming language