How to resolve the algorithm Inconsummate numbers in base 10 step by step in the APL programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Inconsummate numbers in base 10 step by step in the APL programming language

Table of Contents

Problem Statement

A consummate number is a non-negative integer that can be formed by some integer N divided by the the digital sum of N.

47 is a consummate number. On the other hand, there are integers that can not be formed by a ratio of any integer over its digital sum. These numbers are known as inconsummate numbers.

62 is an inconsummate number. There is no integer ratio of an integer to its digital sum that will result in 62. The base that a number is expressed in will affect whether it is inconsummate or not. This task will be restricted to base 10.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Inconsummate numbers in base 10 step by step in the APL programming language

Source code in the apl programming language

task{
    gen  ~((/)=)(÷(+/¨)¨)(×9×)
    incons  gen 9999
    'The first 50 inconsummate numbers:'
    5 1050incons
    'The 1000th inconsummate number:',incons[1000]
}


  

You may also check:How to resolve the algorithm Function definition step by step in the LSE64 programming language
You may also check:How to resolve the algorithm Sieve of Pritchard step by step in the BASIC programming language
You may also check:How to resolve the algorithm Determine if a string has all the same characters step by step in the Perl programming language
You may also check:How to resolve the algorithm Sorting algorithms/Insertion sort step by step in the Miranda programming language
You may also check:How to resolve the algorithm Hello world/Standard error step by step in the Tcl programming language