Jump to content

Magic squares of doubly even order: Difference between revisions

m
m (→‎{{header|AppleScript}}: ( slight reordering ))
Line 602:
limit = sqr + 1
series
-- For integer powers of 2, the (append not) 'magic' series directly
-- yields the truth table that we need
| isPowerOf 2 n =
magicSeries $ floor (logBase 2 (fromIntegral sqr))
-- where n is not an integera power of 2, we can replicate a
-- minimum truth table, horizontally and vertically
| otherwise = (concat $. concat $. concat $.
scale $. fmap scale $ splitEvery 4 $ magicSeries 4)
where
scale = replicate $ quot n 4
9,659

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.