[Archive!] Pure mathematics, physics, chemistry, etc.: brain-training problems not related to trade in any way - page 452

 
Mathemat:

By and large, you have to remove the restrictions on the amount. All the reasoning remains essentially the same, just more of it.

Judging by the fact that in the quote the man needed Cray 1, his algorithm was less optimized than yours :)

1. You cannot remove the limit on the amount - it is part of the problem. Different sums produce different results.

2. In all seriousness, I tried hard. :)

Several features make the script fast. First, and probably most "speedy" is multiplier decomposition table, which is built ONE time at the beginning.

It allows to refuse from building decompositions in each cycle of number checking - it is enough to look in the table.

BUT. (!) :(

Now we're stuck with its size.

However, if we don't build the table, but simply decompose it into multipliers each time, then we can't do without Cray - it will take us months to solve the problem.

Resumo: there's something else we need to optimize. :)

I think.

 
MetaDriver:

Thinking.

Nothing radical has been thought of yet. But I managed to move up to 5000

2011.01.15 21:08:46 MetaSage (EURUSD,M1) //+---- Max = 5000 -------------------+
2011.01.15 21:08:29 MetaSage (EURUSD,M1) S=373; P=19776; a=64; b=309
2011.01.15 21:08:29 MetaSage (EURUSD,M1) S=343; P=9952; a=32; b=311
2011.01.15 21:08:2915 21:08:29 PM MetaSage (EURUSD,M1) S=233; P=916; a=4; b=229
2011.01.15 21:08:29 PM MetaSage (EURUSD,M1) S=163; P=4192; a=32; b=131
2011.01.15 21:08:29 MetaSage (EURUSD,M1) S=149; P=5494; a=67; b=82
2011.01.15 21:08:29 MetaSage (EURUSD,M1) S=137; P=4672; a=64; b=73
2011.01.15 21:08:29 MetaSage (EURUSD,M1) S=127; P=1776; a=16; b=111
2011.01.15 21:08:29 MetaSage (EURUSD,M1) S=89; P=1168; a=16; b=73
2011.01.15 21:08:29 MetaSage (EURUSD,M1) S=65; P=244; a=4; b=61
2011.01.15 21:08:29 MetaSage (EURUSD,M1) S=17; P=52; a=4; b=13
2011.01.01.15 21:08:29 MetaSage (EURUSD,M1) //+---- Max = 5000 -------------------+
2011.01.15 21:08:29 MetaSage (EURUSD,M1) //============== START ========================
2011.01.1515 21:07:58 MetaSage (EURUSD,M1) at 5000 SMax*(SMax/6-1) = 4160000
2011.01.15 21:07:40 MetaSage (EURUSD,M1) //+---- Maximum amount = 4700 -------------------+
2011.01.15 21:07:24 MetaSage (EURUSD,M1) S=373; P=19776; a=64; b=309
2011.01.15 21:07:2415 21:07:24 MetaSage (EURUSD,M1) S=343; P=9952; a=32; b=311
2011.01.15 21:07:23 MetaSage (EURUSD,M1) S=233; P=916; a=4; b=229
2011.01.15 21:07:23 MetaSage (EURUSD,M1) S=163; P=4192; a=32; b=131
2011.01.15 21:07:23 MetaSage (EURUSD,M1) S=137; P=4672; a=64; b=73
2011.01.15 21:07:23 MetaSage (EURUSD,M1) S=127; P=1776; a=16; b=111
2011.01.15 21:07:23 MetaSage (EURUSD,M1) S=89; P=1168; a=16; b=73
2011.01.15 21:07:23 MetaSage (EURUSD,M1) S=65; P=244; a=4; b=61
2011.01.15 21:07:23 MetaSage (EURUSD,M1) S=17; P=52; a=4; b=13
2011.01.15 21:07:23 MetaSage (EURUSD,M1) //+---- Max = 4700 -------------------+
2011.01.15 21:07:23 MetaSage (EURUSD,M1) //============== START ========================
2011.01.15 21:06:56 MetaSage (EURUSD,M1) at 4700 SMax*(SMax/6-1) = 3675400

.

The main optimization ideas are around reducing the size of the table by storing only the first multiplier in cells and getting the next dynamically by reference in the same table.

However it is a space saving in time which will be of course less than in case of construction of a number of factors each time from zero, but still considerably more than now.

I'm thinking again.

 

Nah. Not going to do a space-for-time swap. Even at the current rate of 6900 it counts for about 3 minutes. // I lied, about 2 :)

In the case of referring to the table the number of calculations will quadratically increase.

True, when you calculate each time the increase is exponential, but that's something to be proud of, it's a slowdown anyway.


2011.01.15 21:33:44 MetaSage (EURUSD,M1) //+---- Max = 6900 -------------------+
2011.01.15 21:33:04 MetaSage (EURUSD,M1) S=373; P=19776; a=64; b=309
2011.01.15 21:33:04 MetaSage (EURUSD,M1) S=343; P=9952; a=32; b=311
15 21:33:04 MetaSage (EURUSD,M1) S=233; P=916; a=4; b=229
2011.01.15 21:33:04 MetaSage (EURUSD,M1) S=217; P=11392; a=89; b=128
2011.01.15 21:33:04 MetaSage (EURUSD,M1) S=163; P=4192; a=32; b=131
2011.01.15 21:33:04 MetaSage (EURUSD,M1) S=137; P=4672; a=64; b=73
2011.01.15 21:33:04 MetaSage (EURUSD,M1) S=127; P=1776; a=16; b=111
2011.01.15 21:33:04 MetaSage (EURUSD,M1) S=89; P=1168; a=16; b=73
2011.01.01.15 21:33:04 MetaSage (EURUSD,M1) S=65; P=244; a=4; b=61
2011.01.15 21:33:04 MetaSage (EURUSD,M1) S=17; P=52; a=4; b=13
2011.01.15 21:31:4815 21:31:48 MetaSage (EURUSD,M1) With SMax=6900 PMax = SMax*(uint)(SMax/6-1) = 7928100
2011.01.15 21:31:46 MetaSage (EURUSD,M1) //+---- Max = 6900 -------------------+
2011.01.15 21:31:46 MetaSage (EURUSD,M1) //============== START ========================


At 7000 - Error 4004: "ArrayResize(): Amount of requested memory exceeds two gigs. You need to be more modest."

If someone here has 64x bit + Win64 + MT5 64x + 8 gigs of memory, you can get up to 10 thousand, then it's a bummer anyway.

I suggest we stop there. Actually the original Wise Men have been in the arse for a long time now.

 

Yeah, you can stop, that's for sure. You've already created a miracle which has leapfrogged Cray.

And yet the pattern about numbers remains, i.e. one of them is a degree of two. But there are dubious cases - when an odd number is not prime:

S=127; P=1776; a=16; b=111

S=373; P=19776; a=64; b=309.

 
Mathemat:

1. yeah, you can stop, that's for sure. You've already created a miracle that Cray jumped over.

2. And yet the pattern about numbers remains, i.e. one of them is a degree of two. But there are dubious cases - when an odd number is not prime:

S=127; P=1776; a=16; b=111

S=373; P=19776; a=64; b=309.

1. I agree. :)

2. Are you suggesting you check on a computer? We could, but it would be a long printout. I'll figure it out.

 
I will finalise and refine my sum checking function for an arbitrary constraint. There is an impression that solutions will become less and less frequent as the constraint grows.
 
Mathemat:
I will finish and refine my sum checking function for an arbitrary constraint. There is an impression that as the constraint grows, the solutions will become rarer and rarer.

Not a fact:

2011.01.15 22:52:56 MetaSage (EURUSD,M1) //+---- Maximum amount = 8000 -------------------+
2011.01.15 22:51:55 MetaSage (EURUSD,M1) S=373; P=19776; a=64; b=309
2011.01.15 22:51:55 MetaSage (EURUSD,M1) S=343; P=9952; a=32; b=311
2011.01.15 22:51:55 MetaSage (EURUSD,M1) S=247; P=1912; a=8; b=239
2011.01.15 22:51:55 MetaSage (EURUSD,M1) S=233; P=916; a=4; b=229
2011.01.15 22:51:55 MetaSage (EURUSD,M1) S=217; P=11392; a=89; b=128
2011.01.15 22:51:55 MetaSage (EURUSD,M1) S=185; P=724; a=4; b=181
2011.01.15 22:51:55 MetaSage (EURUSD,M1) S=179; P=2608; a=16; b=163
2011.01.15 22:51:55 MetaSage (EURUSD,M1) S=163; P=4192; a=32; b=131
2011.01.15 22:51:55 MetaSage (EURUSD,M1) S=137; P=4672; a=64; b=73
2011.01.15 22:51:55 MetaSage (EURUSD,M1) S=127; P=1776; a=16; b=111
2011.01.15 22:51:55 MetaSage (EURUSD,M1) S=89; P=1168; a=16; b=73
2011.01.15 22:51:55 MetaSage (EURUSD,M1) S=65; P=244; a=4; b=61
2011.01.15 22:51:55 MetaSage (EURUSD,M1) S=17; P=52; a=4; b=13
2011.01.15 22:50:34 MetaSage (EURUSD,M1) With SMax=8000 PMax = SMax*(SMax/8-1) = 7992000
2011.01.15 22:50:33 MetaSage (EURUSD,M1) //+---- Max = 8000 -------------------+
2011.01.15 22:50:33 MetaSage (EURUSD,M1) //============== START ========================

There are already thirteen solutions.

 
MetaDriver: Thirteen solutions already.

Not a fact. These are the decision candidates. You've agreed to it yourself. And "solutions" with a composite odd makes me very uneasy - although I can't substantiate that suspicion.

But the trend is encouraging. You're getting closer to ten thousand. Wise men are wise, and we are programmers.

 
Mathemat:

1. Not a fact. These are the decision candidates. You've agreed to it yourself. And "solutions" with a composite odd makes me very uneasy - although I can't substantiate that suspicion.

2. But the trend is encouraging. You're getting closer to 10 grand.

1. I didn't think it through. I've had a lot more faith in my script since then. :)

For when trying to make a "checker", I realized that there's nothing to check - everything works properly.

However, you can still make a printer - for example, to mess up the Mechmaty forum with spoils... :))))

// And at the same time to calm you down. ;)

I just have to figure out what to print.

2. That's the way it is.Get it signed.


2011.01.15 23:18:16 MetaSage (EURUSD,M1) //+---- Maximum amount = 10000 -------------------+
2011.01.15 23:16:31 MetaSage (EURUSD,M1) S=373; P=19776; a=64; b=309
2011.01.15 23:16:30 MetaSage (EURUSD,M1) S=343; P=9952; a=32; b=311
2011.01.15 23:16:30 MetaSage (EURUSD,M1) S=247; P=1912; a=8; b=239
2011.01.15 23:16:30 MetaSage (EURUSD,M1) S=233; P=916; a=4; b=229
2011.01.15 23:16:30 MetaSage (EURUSD,M1) S=217; P=11392; a=89; b=128
2011.01.15 23:16:30 MetaSage (EURUSD,M1) S=191; P=8128; a=64; b=127
2011.01.15 23:16:30 MetaSage (EURUSD,M1) S=185; P=724; a=4; b=181
2011.01.15 23:16:30 MetaSage (EURUSD,M1) S=179; P=2608; a=16; b=163
2011.01.15 23:16:30 MetaSage (EURUSD,M1) S=163; P=4192; a=32; b=131
2011.01.15 23:16:30 MetaSage (EURUSD,M1) S=137; P=4672; a=64; b=73
2011.01.15 23:16:30 MetaSage (EURUSD,M1) S=127; P=1776; a=16; b=111
2011.01.15 23:16:30 MetaSage (EURUSD,M1) S=89; P=1168; a=16; b=73
2011.01.15 23:16:30 MetaSage (EURUSD,M1) S=65; P=244; a=4; b=61
2011.01.15 23:16:30 MetaSage (EURUSD,M1) S=17; P=52; a=4; b=13
2011.01.15 23:15:36 MetaSage (EURUSD,M1) With SMax=10000 PMax = SMax*(SMax/16-1) = 6240000
2011.01.15 23:15:34 MetaSage (EURUSD,M1) //+---- Max = 10000 -------------------+
2011.01.15 23:15:34 MetaSage (EURUSD,M1) //============== START ========================


I attach the winning version of the script.

Files:
 

Note that in my last piece of evidence for amounts less than 100 there were only 4 amounts left: 17, 29, 41, 53. All of them are prime (probably by accident), and, moreover, they are represented as 2^n+prime in a single way (which is not by accident). That's what stresses me out when I look at your variants of solutions.

And what do you keep in your big table? It looks like there's a lot of unnecessary stuff there. Where do wise men have 5 million numbers in their heads?

Found the first 1,000 simple ones on the internet - up to about 8,000.

Reason: