How to resolve the algorithm Eban numbers step by step in the K programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Eban numbers step by step in the K programming language
Table of Contents
Problem Statement
An eban number is a number that has no letter e in it when the number is spelled in English. Or more literally, spelled numbers that contain the letter e are banned.
The American version of spelling numbers will be used here (as opposed to the British). 2,000,000,000 is two billion, not two milliard.
Only numbers less than one sextillion (1021) will be considered in/for this task. This will allow optimizations to be used.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Eban numbers step by step in the K programming language
Source code in the k programming language
eban: {1_((x<)_,/(,/(2*!4)+/:10*0,3+!4)+/:1000*)/0}@_:
#eban 1000
19
#(1000>)_eban 4000
21
#eban 1e4
79
#eban 1e5
399
#eban 1e6
399
#eban 1e7
1599
#eban 1e8
7999
#eban 1e9
7999
#eban 1e10
31999
#eban 1e11
159999
#eban 1e12
159999
#eban 1e13
639999
#eban 1e14
3199999
You may also check:How to resolve the algorithm Sorting algorithms/Merge sort step by step in the REXX programming language
You may also check:How to resolve the algorithm Anonymous recursion step by step in the Wren programming language
You may also check:How to resolve the algorithm Detect division by zero step by step in the Yorick programming language
You may also check:How to resolve the algorithm Terminal control/Preserve screen step by step in the Scala programming language
You may also check:How to resolve the algorithm Integer comparison step by step in the Racket programming language