How to resolve the algorithm Munchausen numbers step by step in the PicoLisp programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Munchausen numbers step by step in the PicoLisp 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 PicoLisp programming language

Source code in the picolisp programming language

(for N 5000
   (and
      (=
         N
         (sum
            '((N) (** N N))
            (mapcar format (chop N)) ) )
      (println N) ) )

  

You may also check:How to resolve the algorithm Delegates step by step in the F# programming language
You may also check:How to resolve the algorithm Loops/Foreach step by step in the Pascal programming language
You may also check:How to resolve the algorithm Monads/List monad step by step in the Python programming language
You may also check:How to resolve the algorithm Hostname step by step in the MATLAB programming language
You may also check:How to resolve the algorithm Quickselect algorithm step by step in the Nim programming language