How to resolve the algorithm Disarium numbers step by step in the Quackery programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Disarium numbers step by step in the Quackery programming language
Table of Contents
Problem Statement
A Disarium number is an integer where the sum of each digit raised to the power of its position in the number, is equal to the number.
135 is a Disarium number: 11 + 32 + 53 == 1 + 9 + 125 == 135 There are a finite number of Disarium numbers.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Disarium numbers step by step in the Quackery programming language
Source code in the quackery programming language
[ [ [] swap
[ 10 /mod
rot join swap
dup 0 = until ]
drop ] ] is digits ( n --> [ )
[ 0 over digits
witheach
[ i^ 1+ ** + ] = ] is disarium ( n --> b )
[ temp put [] 0
[ dup disarium if
[ dup dip join ]
1+
over size
temp share = until ]
drop ] is disariums ( n --> [ )
19 disariums echo
You may also check:How to resolve the algorithm Cullen and Woodall numbers step by step in the Haskell programming language
You may also check:How to resolve the algorithm Continued fraction/Arithmetic/G(matrix ng, continued fraction n) step by step in the Fortran programming language
You may also check:How to resolve the algorithm Create a two-dimensional array at runtime step by step in the Picat programming language
You may also check:How to resolve the algorithm Integer comparison step by step in the ALGOL W programming language
You may also check:How to resolve the algorithm Day of the week step by step in the Icon and Unicon programming language