How to resolve the algorithm O'Halloran numbers step by step in the AppleScript programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm O'Halloran numbers step by step in the AppleScript programming language

Table of Contents

Problem Statement

For this task, for our purposes, a cuboid is a 3 dimensional object, with six rectangular faces, where all angles are right angles, opposite faces of the cuboid are equal, and where each dimension is a positive integer unit length. It will subsequently be referred to simply as a cuboid; but be aware that it references the above definition. The surface area of a cuboid is two times the length times the width, plus two times the length times the height, plus two times the width times the height. A cuboid will always have an even integer surface area. The minimum surface area a cuboid may have is 6; one where the l, w, and h measurements are all 1. Different cuboid configurations (may) yield different surface areas, but the surface area is always an integer and is always even. A cuboid with l = 2, w = 1 h = 1 has a surface area of 10 There is no configuration which will yield a surface area of 8. There are 16 known even integer values below 1000 which can not be a surface area for any integer cuboid. It is conjectured, though not rigorously proved, that no others exist. that can not be the surface area of a cuboid.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm O'Halloran numbers step by step in the AppleScript programming language

Source code in the applescript programming language

on OHalloranNumbers(max)
    script o
        property evens : {missing value, missing value}
    end script
    repeat with n from 6 to max by 2
        set end of o's evens to n
    end repeat
    set halfMax to max div 2
    set sixthMax to halfMax div 3
    repeat with x from 1 to sixthMax
        repeat with y from x to (sixthMax div x)
            repeat with halfArea from ((x + x + y) * y) to halfMax by (x + y)
                set o's evens's item halfArea to missing value
            end repeat
        end repeat
    end repeat
    return o's evens's integers
end OHalloranNumbers

OHalloranNumbers(1000 - 1)

(* Repeat logic condensed from:
    repeat with x from 1 to sixthMax
        repeat with y from x to sixthMax
            set xy to x * y
            if (xy > sixthMax) then exit repeat
            repeat with z from y to sixthMax
                set halfArea to xy + (x + y) * z
                if (halfArea > halfMax) then exit repeat
                set o's evens's item halfArea to missing value
            end repeat
        end repeat
    end repeat
*)


{8, 12, 20, 36, 44, 60, 84, 116, 140, 156, 204, 260, 380, 420, 660, 924}


  

You may also check:How to resolve the algorithm Hello world/Standard error step by step in the Lasso programming language
You may also check:How to resolve the algorithm String length step by step in the Java programming language
You may also check:How to resolve the algorithm Pisano period step by step in the REXX programming language
You may also check:How to resolve the algorithm Ranking methods step by step in the Tcl programming language
You may also check:How to resolve the algorithm Sequence: smallest number greater than previous term with exactly n divisors step by step in the Dyalect programming language