I don’t understand why people have to make it so complicated. Odd decomposition is similar to the self-conjugate section expanded on its side and expanded, for example n = 13
4 4 3 2 => => => 7 5 1 xxxx rotate x unfold out xxxxxxx xxxx clockwise ↖ xx ↗ each side xxxxx xxx 45 degrees xxx => x xxxxxxxxx
The larger the odd decomposition, the greater the “bounding square” of the corresponding self-adjoint. By "bounding box" I mean the square of the upper left corner, which is a constant in all odd expansions of a similar size. For example, we could write 13 as self-adjoint {5,3,3,1,1} , and the 9-element “bounding box” would remain the same, with the corresponding odd decomposition {9,3,1} :
5 3 3 1 1 => 9 3 1 xxxxxxxxxxxxxx xxxxxx xxxx x x
To get an odd decomposition with the greatest power, find the largest “bounding box” with an even remainder.
Example:
M = 24 Bounding square | remainder 1 23 4 20 9 15 16 8 25...too large Place the remainder in any diagonally-symmetric way you like. The simplest way might be xxxx xxxxxxxx xxxx => xxxx xxxx xxxx xxxx xxxx x x x x Decompose: 15,5,3,1
I think this Haskell code displays all the possibilities:
fm = g [1,3..bestRoot*2 - 1] remainder 0 [] where root = floor (sqrt (fromIntegral m)) bestRoot = head $ dropWhile (\x -> odd (m - x^2)) [root,root - 1..1] remainder = m - bestRoot^2 g (x:xs) r prev res | null xs = [reverse ((x + r):res)] | otherwise = do r' <- takeWhile (<= div remainder bestRoot) [prev,prev + 2..] g xs (r - r') r' ((x + r'):res)
Output:
*Main> f 24 [[1,3,5,15],[1,3,7,13],[1,5,7,11],[3,5,7,9]] *Main> f 23 [[1,3,19],[1,5,17],[1,7,15],[3,5,15],[3,7,13],[5,7,11]] *Main> f 38 [[1,3,5,7,9,13]] *Main> f 37 [[1,3,5,7,21],[1,3,5,9,19],[1,3,7,9,17],[1,5,7,9,15],[3,5,7,9,13]] *Main> f 100 [[1,3,5,7,9,11,13,15,17,19]]