How to resolve the algorithm Munchausen numbers step by step in the FOCAL programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Munchausen numbers step by step in the FOCAL programming language
Table of Contents
Problem Statement
A Munchausen number is a natural number n the sum of whose digits (in base 10), each raised to the power of itself, equals n. (Munchausen is also spelled: Münchhausen.) For instance: 3435 = 33 + 44 + 33 + 55
Find all Munchausen numbers between 1 and 5000.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Munchausen numbers step by step in the FOCAL programming language
Source code in the focal programming language
01.10 F N=1,5000;D 2
02.10 S M=N;S S=0
02.20 S D=M-FITR(M/10)*10
02.25 S S=S+D^D
02.30 S M=FITR(M/10)
02.40 I (M),2.5,2.2
02.50 I (N-S)2.7,2.6,2.7
02.60 T %4,N,!
02.70 R
You may also check:How to resolve the algorithm Flatten a list step by step in the Elixir programming language
You may also check:How to resolve the algorithm Enforced immutability step by step in the Racket programming language
You may also check:How to resolve the algorithm Fractal tree step by step in the Yabasic programming language
You may also check:How to resolve the algorithm Draw a pixel step by step in the Robotic programming language
You may also check:How to resolve the algorithm Equilibrium index step by step in the jq programming language