[Archive!] Pure mathematics, physics, chemistry, etc.: brain-training problems not related to trade in any way - page 451
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Here is the result with SMax=3000
2011.01.15 19:14:26 MetaSage (EURUSD,M1) //+---- Max = 3000 -------------------+
2011.01.15 19:14:21 MetaSage (EURUSD,M1) S=163; P=4192; a=32; b=131
2011.01.15 19:14:21 MetaSage (EURUSD,M1) S=127; P=1776; a=16; b=111
2011.01.15 19:14:21 MetaSage (EURUSD,M1) S=89; P=1168; a=16; b=73
2011.01.15 19:14:21 MetaSage (EURUSD,M1) S=65; P=244; a=4; b=61
2011.01.15 19:14:21 MetaSage (EURUSD,M1) S=17; P=52; a=4; b=13
2011.01.15 19:14:21 MetaSage (EURUSD,M1) //+---- Maximum amount = 3000 -------------------+
1. By and large, you have to remove the restrictions on the amount. All reasoning remains essentially the same, just more of it.
2. Judging by the fact that in the quote the man needed a Cray 1, his algorithm was less optimized than yours :)
1. Large is not possible - my multiplier expansion table doesn't fit in memory already at SMax=3400.
Any advances with lemma for maximal product for a given SMax ?
Here is printout for 3300:
2011.01.15 19:18:06 MetaSage (EURUSD,M1) S=163; P=4192; a=32; b=131
2011.01.15 19:18:06 MetaSage (EURUSD,M1) S=127; P=1776; a=16; b=111
2011.01.15 19:18:06 MetaSage (EURUSD,M1) S=89; P=1168; a=16; b=73
2011.01.15 19:18:06 MetaSage (EURUSD,M1) S=65; P=244; a=4; b=61
2011.01.15 19:18:06 MetaSage (EURUSD,M1) S=17; P=52; a=4; b=13
2011.01.15 19:18:06 MetaSage (EURUSD,M1) //+---- Max = 3300 -------------------+
.
2. No, it's just that mql5 is a very fast language... :)
How long was the count? Not five seconds...
Checked at SMax=3350. The result is the same. Counts for about a minute, even less.
Main limitation right now is memory. We need to limit the multiplier decomposition table.
Current version of PMax=SMax*(SMax/2-1). May it be decreased further? Can you enable it?
I think it's easy enough to prove that PMax<=SMax*(sqrt(SMax)-1). I'll try to run it now and if it crashes it means I'm wrong. :)
It did not work (it built a table, but it appeared to be too small), but I managed to find one more solution (!) :-)
2011.01.15 19:40:28 MetaSage (EURUSD,M1) Array out of range in 'MetaSage.mq5' (100,47)
2011.01.15 19:40:24 MetaSage (EURUSD,M1) S=343; P=9952; a=32; b=311
2011.01.15 19:40:24 MetaSage (EURUSD,M1) S=163; P=4192; a=32; b=131
2011.01.15 19:40:24 MetaSage (EURUSD,M1) S=127; P=1776; a=16; b=111
2011.01.15 19:40:24 MetaSage (EURUSD,M1) S=89; P=1168; a=16; b=73
2011.01.15 19:40:24 MetaSage (EURUSD,M1) S=65; P=244; a=4; b=61
2011.01.15 19:40:24 MetaSage (EURUSD,M1) S=17; P=52; a=4; b=13
2011.01.15 19:40:24 MetaSage (EURUSD,M1) //+---- Maximum amount = 4000 -------------------+
2011.01.15 19:40:24 MetaSage (EURUSD,M1) //============== START ========================
Now if we could just make sure that these are not just potential solutions, but real solutions.
OK, we can think further by setting a limit of, say, 10,000.
P.S. That's how many numbers you have in the table at 3300?
3300*(3300/2-1) ~ 5 million?
1. Now if we could just make sure that these are not just potential solutions, but real solutions.
OK, we can think further by setting a limit of, say, 10,000.
2. P.S. Is that how many numbers you have in the table at 3300?
3300*(3300/2-1) ~ 5 million?
1. Well, the script is the way to make sure. Change it to a verification version. Will do, but let's deal with PMax first.
2. YES.
Here's some fiddling with the table size. Got the results with SMax=4100.
PMax set as follows: SMax*(uint)(SMax/6-1) = 2796200
2011.01.15 20:21:29 MetaSage (EURUSD,M1) //+---- Max = 4100 -------------------+
2011.01.15 20:21:18 MetaSage (EURUSD,M1) S=343; P=9952; a=32; b=311
2011.01.15 20:21:18 MetaSage (EURUSD,M1) S=163; P=4192; a=32; b=131
2011.01.15 20:21:18 MetaSage (EURUSD,M1) S=137; P=4672; a=64; b=73
2011.01.15 20:21:18 MetaSage (EURUSD,M1) S=127; P=1776; a=16; b=111
2011.01.15 20:21:18 MetaSage (EURUSD,M1) S=89; P=1168; a=16; b=73
2011.01.15 20:21:18 MetaSage (EURUSD,M1) S=65; P=244; a=4; b=61
2011.01.15 20:21:18 MetaSage (EURUSD,M1) S=17; P=52; a=4; b=13
2011.01.15 20:21:18 MetaSage (EURUSD,M1) //+---- Max = 4100 -------------------+
2011.01.15 20:21:18 MetaSage (EURUSD,M1) //============== START ========================
2011.01.15 20:21:00 MetaSage (EURUSD,M1) SMax*(uint)(SMax/6-1) = 2796200
.
As we see, there is one more solution in the middle: S=137; P=4672; a=64; b=73.