How to resolve the algorithm Abundant odd numbers step by step in the Quackery programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Abundant odd numbers step by step in the Quackery programming language
Table of Contents
Problem Statement
An Abundant number is a number n for which the sum of divisors σ(n) > 2n, or, equivalently, the sum of proper divisors (or aliquot sum) s(n) > n.
12 is abundant, it has the proper divisors 1,2,3,4 & 6 which sum to 16 ( > 12 or n); or alternately, has the sigma sum of 1,2,3,4,6 & 12 which sum to 28 ( > 24 or 2n).
Abundant numbers are common, though even abundant numbers seem to be much more common than odd abundant numbers. To make things more interesting, this task is specifically about finding odd abundant numbers.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Abundant odd numbers step by step in the Quackery programming language
Source code in the quackery programming language
[ 0 swap factors witheach + ] is sigmasum ( n --> n )
0 -1 [ 2 +
dup sigmasum
over 2 * over < iff
[ over echo sp
echo cr
dip 1+ ]
else drop
over 25 = until ]
2drop
cr
0 -1
[ 2 + dup sigmasum
over 2 * > if [ dip 1+ ]
over 1000 = until ]
dup echo sp sigmasum echo cr
drop
cr
999999999
[ 2 + dup sigmasum
over 2 * > until ]
dup echo sp sigmasum echo cr
You may also check:How to resolve the algorithm Empty program step by step in the XPL0 programming language
You may also check:How to resolve the algorithm Perfect shuffle step by step in the MATLAB programming language
You may also check:How to resolve the algorithm Loops/For with a specified step step by step in the Dao programming language
You may also check:How to resolve the algorithm Dragon curve step by step in the M4 programming language
You may also check:How to resolve the algorithm Holidays related to Easter step by step in the J programming language