How to resolve the algorithm Digital root/Multiplicative digital root step by step in the 11l programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Digital root/Multiplicative digital root step by step in the 11l programming language

Table of Contents

Problem Statement

The multiplicative digital root (MDR) and multiplicative persistence (MP) of a number,

n

{\displaystyle n}

, is calculated rather like the Digital root except digits are multiplied instead of being added:

Show all output on this page. The Product of decimal digits of n page was redirected here, and had the following description The three existing entries for Phix, REXX, and Ring have been moved here, under ===Similar=== headings, feel free to match or ignore them.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Digital root/Multiplicative digital root step by step in the 11l programming language

Source code in the 11l programming language

F mdroot(n)
   V count = 0
   V mdr = n
   L mdr > 9
      V m = mdr
      V digits_mul = 1
      L m != 0
         digits_mul *= m % 10
         m = m I/ 10
      mdr = digits_mul
      count++
   R (count, mdr)

print(‘Number: (MP, MDR)’)
print(‘======  =========’)
L(n) (123321, 7739, 893, 899998)
   print(‘#6: ’.format(n), end' ‘’)
   print(mdroot(n))

[[Int]] table
table.resize(10)
V n = 0
L min(table.map(row -> row.len)) < 5
   table[mdroot(n)[1]].append(n)
   n++

print(‘’)
print(‘MP: [n0..n4]’)
print(‘==  ========’)
L(val) table
   print(‘#2: ’.format(L.index), end' ‘’)
   print(val[0.<5])

  

You may also check:How to resolve the algorithm Polynomial regression step by step in the zkl programming language
You may also check:How to resolve the algorithm Terminal control/Dimensions step by step in the PureBasic programming language
You may also check:How to resolve the algorithm Almost prime step by step in the ALGOL 68 programming language
You may also check:How to resolve the algorithm Count in octal step by step in the PL/M programming language
You may also check:How to resolve the algorithm Thue-Morse step by step in the Visual Basic .NET programming language