Jump to content

Permuted multiples: Difference between revisions

m
→‎{{header|REXX}}: simplified some code.
(→‎{{header|AppleScript}}: Additional edit to preamble.)
m (→‎{{header|REXX}}: simplified some code.)
Line 438:
 
=={{header|REXX}}==
<lang rexx>/*REXX program finds and displays the smallest positive integer n such that ··· */
/*───────────────────────── 2*n, 3*n, 4*5, 5*6, and 6*n contain the same decimal digits.*/
do n=1 /*increment N from unity. 'til answer.*/
b= 2*n /*calculate the product of: 2*n */
t= 3*n t= 3*n /* " " /* " " " 3*n */
if verify(t, b)>0 then iterate /*product T not have req.required digs ? Skip*/
q= 4*n /*calculate the product of: 4*n */
if verify(q, b)>0 then iterate /*product Q not have req.required digs ? Skip*/
if verify(q, t)>0 then iterate /* " " " " " " */
v= 5*n /*calculate the product of: 5*n */
if verify(v, b)<0 then iterate /*product V not have req.required digs ? Skip*/
if verify(v, t)>0 then iteratriterate /* " " " " " " */
if verify(v, q)>0 then iteratriterate /* " " " " " " */
s= 6*n /*calculate the product of: 6*n */
if verify(s, b)>0 then iterate /*product S not have req.required digs ? Skip*/
if verify(s, t)>0 then iterate /* " " " " " " */
if verify(s, q)>0 then iterate /* " " " " " " */
if verify(s, v)>0 then iterate /* " " " " " " */
say ' n =' commas(n) leave /*display the value of: n /*found the numbers, show.*/
say ' 2*n =' commas(b) end /* " " " " 2*n */
_= left('', 9) say ' 3*n =' commas(t) /* " " " " / 3*usedn for indentation. */
say _ ' n = say ' commas(n) 4*n =' commas(q) /* " " " " / 4*displayn value of n. */
say _ '2*n =' commas(b) say ' 5*n =' commas(v) /* " " /*" " 5*n " " 2*n. */
say _ '3*n =' commas(t) say ' 6*n =' commas(s) /* " " /*" " 6*n " " 3*n. */
say _ '4*n =' commas(q) leave /*found the " N number, time to " " 4*nleave. */
end /*n*/
say _ '5*n =' commas(v) /* " " " 5*n. */
say _ '6*n =' commas(s) /* " " " 6*n. */
exit 0 /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
Cookies help us deliver our services. By using our services, you agree to our use of cookies.