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

 
MetaDriver >>:

Я и на васике могу в четыре-пять строк уложиться

:)

I do. But it would be interesting to see...

 
admin писал(а) >>

No way...
And here's what the perl algorithm looks like:


for(111..999){
split(//,$_);
my($sum,$mul)=(0,1);
for(@_){$sum+=$_;$mul*=$_;}
print("$_\n") if($sum*12==$mul);
}


I've known BASIC for about 18 years. But what you have written I can't even understand. I don't know Perl. In general, in Basic it would be even easier if you could hide almost everything in a module, for example like this:
-
Private Sub Command1_Click()
Me.PrintList(MathMod.OtnProSum(1,1e5))
End Sub

 
MetaDriver писал(а) >>

He's just a programmer.... >> so-so.

I'll say more than that. He's not a programmer at all.

 
admin >>:

Верю. Но интересно было бы взглянуть...

Take a look...
;)
Files:
 
Private Sub FindAllButton_Click()
  For i = 111 To 999
    If ((1# * (i Mod 10) * ((i Mod 100) \ 10) * (i \ 100)) / (i Mod 10 + (i Mod 100) \ 10 + i \ 100) = 12) Then Range("c4").Value = i
  Next i
End Sub
And this is, in fact, the counting algorithm. "Pure algorithm" fits in three lines, if you don't count the header and the closing End function :)
 
On ruby(there is a normal bigint) for any size n. :)
n=6;
(10**(n-1)..10**n-1).each{|i|
sum=0;mul=1
(1..n).each{|s|
d=i%10**s/10**(s-1)
sum+=d;mul*=d
}
if mul/sum==12
print i,"\n"
end
}
 
MetaDriver >>:
А это, собсно, алгоритм счёта. "Чиста алгоритм" уместился в трёх строках, ежли не считать заголовок и закрывающий End функции :)

Cool!

 
Richie, can you check on your Wasik if the equality "30 as a sum of three cubes" given on page 322 of the thread: https://c.mql4.com/forum/2010/04/cohen.GIF is exactly true ?
Richie, in this case "exactly" is absolutely exact, with zero error: it is the equality for integers from the book on Diophantine equations.
 
Mathemat писал(а) >>
Richie, but you can check on your Wasik if the equality "30 as a sum of three cubes" given on page 322 of the thread: https://c.mql4.com/forum/2010/04/cohen.GIF?
Richie, in this case "exactly" is absolutely exact, with zero error: it is the equality for integers from the book on Diophantine equations.



Unfortunately with standard data types like Double and Long nothing works. Now I regret that after graduation I destroyed the library of VB functions that allow me to do precise calculations with very large and very small numbers by creating my own data types in VB.
-
I tried it in VB with Double type - it turned out to be bullshit, in Excel it turned out to be zero.
The library worked simply - numbers were stored as strings of String type. Actions were performed on these strings after they were converted into the Byte format. If we had more time we could write again.
-
Maybe there is some other - tricky way of proving it?

 
Mathemat писал(а) >>
Richie, but you can check on your Wasik if the equality "30 as a sum of three cubes" given on page 322 of the thread: https://c.mql4.com/forum/2010/04/cohen.GIF?
Richie, in this case "exactly" is absolutely exact, with zero error: it is the equality for integers from the book on Diophantine equations.


You can do the math in a Windows calculator.