Jump to content

Wikipedia:Reference desk/Archives/Mathematics/2024 September 30

From Wikipedia, the free encyclopedia
Mathematics desk
< September 29 << Aug | September | Oct >> Current desk >
Welcome to the Wikipedia Mathematics Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


September 30

[edit]

How to find max(xy) for each r where x + y = r and x, y are positive integers

[edit]

Drawing fractal canopy diagrams had me wondering for a given SVG file size, I could add more branches or more depth. Below are two examples:

2 branches, depth 12
4 branches, depth 8

To make the tree as dense as possible, I wish to maximise the number of leaf nodes. In other words, how can I find max(xy) for each r where x + y = r and x, y are positive integers?

I realise I can use calculus but I'm unsure what equation I should differentiate.

Thanks, cmɢʟeeτaʟκ 00:50, 30 September 2024 (UTC)[reply]

Unfortunately, this is actually quite complicated. We can rewrite the problem as , and consider all real instead of just integers. Notice that . Because is monotonic over , is maximized when is. Its derivative is , which is when . This is a nice closed-form expression, but it's for in terms of . Inverting it is complicated, but Wolfram Alpha gives us where is the Lambert W function. While this is sort of a closed-form expression, it's still unfortunately annoying to work with since is implicitly defined as . In any case, is irrational for all positive rational . The proof of this is annoying so I've put it below, but ultimately what it implies is that when , as far as I can tell, the best you can do is either round for convenience, or take floor/ceiling of and compare values to get the max over integers.
Proof that is irrational for positive rational
  1. Suppose , and let .
  2. and , so as well.
  3. By definition, . Since , we can rearrange to get .
  4. Lindemann's 1882 theorem implies that if is nonzero rational, then is not only irrational, but transcendental as well.
  5. If is rational, then since , is transcendental, while is rational, which is contradictory.
  6. must be irrational and is nonzero, so is irrational.
  7. We conclude that implies is irrational.
GalacticShoe (talk) 02:41, 30 September 2024 (UTC)[reply]
Here is a numerical recipe (Newton's method) for solving for real-valued :
  1. Set
  2. Iterate the replacement until convergence, where
In practice (), two iterations will bring you close enough; then test and to get the optimal integer value.  --Lambiam 10:17, 30 September 2024 (UTC)[reply]
Thanks so much, @GalacticShoe and @Lambiam. I thought analytically I was heading into a dead end. Guess solving it iteratively is still the best for small values. cmɢʟeeτaʟκ 11:45, 30 September 2024 (UTC)[reply]
P.S. It seems there's an interesting trend:
x=1 for r=2 (1 term): 1¹.
x=2 for r=3 to 4 (2 terms): 2¹ and 2².
x=3 for r=5 to 7 (3 terms): 3², 3³ and 3⁴.
x=4 for r=8 to 11 (4 terms): 4⁴, 4⁵, 4⁶ and 4⁷.
x changes when r is the x–1th triangular number + 2. Serendipity? cmɢʟeeτaʟκ 17:06, 30 September 2024 (UTC)[reply]
Unfortunately, serendipity. The number of for each is the sequence OEIS:A108414. Although it starts with , it quickly levels out. The inverse triangular number function you're looking for is , while grows faster than , which in turn grows faster than , hence the number of terms slowing down in growth. GalacticShoe (talk) 03:46, 1 October 2024 (UTC)[reply]
Note that, unlike for Tn, these first differences in the r-values for which x changes do not only always increase but may even decrease.  --Lambiam 03:58, 1 October 2024 (UTC)[reply]
After some testing, it seems that rounding suffices at least for r < 100, possibly more. To simplify it, applying Newton's method twice, we can get this approximation which maximizes for these values of :
GalacticShoe (talk) 04:14, 1 October 2024 (UTC)[reply]
Thanks so much, @Lambiam and @GalacticShoe. I much appreciate the time and effort you've put into it. Cheers, cmɢʟeeτaʟκ 20:17, 2 October 2024 (UTC)[reply]