mersenneforum.org  

Go Back   mersenneforum.org > Fun Stuff > Puzzles

Reply
 
Thread Tools
Old 2016-03-17, 13:33   #12
henryzz
Just call me Henry
 
henryzz's Avatar
 
"David"
Sep 2007
Cambridge (GMT/BST)

23·3·5·72 Posts
Default

Quote:
Originally Posted by ramshanker View Post
Are there no 14 & 18 digit answer to this? My program didn't turn-up anything. I am having doubt whether I am doing it right or not.

Though it did reproduce the 10 & 12 digit ones posted above. My code is for even digits only.
There is an 18 digit solution.
henryzz is offline   Reply With Quote
Old 2016-03-18, 15:03   #13
ramshanker
 
ramshanker's Avatar
 
"Ram Shanker"
May 2015
Delhi

2·19 Posts
Default

Quote:
Originally Posted by henryzz View Post
There is an 18 digit solution.
Ok, I figured out the bug in my python code. Can someone explain this to me.

After a certain number of digits, python results give incorrect division values.

>>> int( 194216878433174216 / 10 ) % 10
0

>>> int( 19421687843317421 / 10 ) % 10
2
>>> int( 1942168784331742 / 10 ) % 10
4
>>> int( 19421687843317 / 10 ) % 10
1
>>> int( 1942168784331 / 10 ) % 10
3
>>> int( 194216878433 / 10 ) % 10
3



First result is wrong. Trying on my 64 bit Python 3.5.0 shell. Is it a bug in python interpreter or it's supposed to be this way only?
It gives correct for high digit multiplication.

>>> 194216878433174216 * 194216878433174216
37720195868326371910875197407214656

So obviously it can handle >64 bit numbers, but some problem at the boundary?

Anyway I figured out a way for odd number and found both 15 digit ones. Now running for those 18 digit ones. :)

Last fiddled with by ramshanker on 2016-03-18 at 15:05
ramshanker is offline   Reply With Quote
Old 2016-03-18, 16:02   #14
Dubslow
Basketry That Evening!
 
Dubslow's Avatar
 
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88

3·29·83 Posts
Default

Quote:
Originally Posted by ramshanker View Post
Ok, I figured out the bug in my python code. Can someone explain this to me.

After a certain number of digits, python results give incorrect division values.

>>> int( 194216878433174216 / 10 ) % 10
0

>>> int( 19421687843317421 / 10 ) % 10
2
>>> int( 1942168784331742 / 10 ) % 10
4
>>> int( 19421687843317 / 10 ) % 10
1
>>> int( 1942168784331 / 10 ) % 10
3
>>> int( 194216878433 / 10 ) % 10
3



First result is wrong. Trying on my 64 bit Python 3.5.0 shell. Is it a bug in python interpreter or it's supposed to be this way only?
It gives correct for high digit multiplication.

>>> 194216878433174216 * 194216878433174216
37720195868326371910875197407214656

So obviously it can handle >64 bit numbers, but some problem at the boundary?

Anyway I figured out a way for odd number and found both 15 digit ones. Now running for those 18 digit ones. :)
The / operator always gives a floating point result (in Python 3+). The result highlighted is the first number on your list large enough that the last digit of the result is lost due to rounding error. Use the // operator instead (and drop the int() conversion).

Code:
In [1]:  194216878433174216/10
Out[1]: 1.942168784331742e+16

In [2]: 19421687843317421/10
Out[2]: 1942168784331742.0

In [3]: 194216878433174216//10
Out[3]: 19421687843317421

Last fiddled with by Dubslow on 2016-03-18 at 16:03
Dubslow is offline   Reply With Quote
Old 2016-03-18, 20:33   #15
ramshanker
 
ramshanker's Avatar
 
"Ram Shanker"
May 2015
Delhi

468 Posts
Default

Ok, found the 18 digit one.

Run-time 5967.29 sec.

Time to go for the big gun... any hint how many minimum digits for "**"?
ramshanker is offline   Reply With Quote
Old 2016-03-18, 20:48   #16
Anonuser
 
Sep 2014

29 Posts
Default

If my program did not miss any solutions, then there are 2 solutions with 21 digits. There seem to be no solutions with 19 or 20 or 22 digits.

Last fiddled with by Anonuser on 2016-03-18 at 20:51
Anonuser is offline   Reply With Quote
Old 2016-03-19, 17:05   #17
henryzz
Just call me Henry
 
henryzz's Avatar
 
"David"
Sep 2007
Cambridge (GMT/BST)

23·3·5·72 Posts
Default

Quote:
Originally Posted by ramshanker View Post
Ok, found the 18 digit one.

Run-time 5967.29 sec.

Time to go for the big gun... any hint how many minimum digits for "**"?
That is much faster than mine. Mine took a couple days.
henryzz is offline   Reply With Quote
Old 2016-03-21, 13:05   #18
ramshanker
 
ramshanker's Avatar
 
"Ram Shanker"
May 2015
Delhi

2616 Posts
Default

Quote:
Originally Posted by Anonuser View Post
there are 2 solutions with 21 digits. .
1 Found.... yeaaaaaaaaaa . Let's see how much higher I can go.
ramshanker is offline   Reply With Quote
Old 2016-04-04, 14:56   #19
R. Gerbicz
 
R. Gerbicz's Avatar
 
"Robert Gerbicz"
Oct 2005
Hungary

27148 Posts
Default

The official solution (what is essentially my solution ) is out at: https://www.research.ibm.com/haifa/p...March2016.html
I've updated the corresponding oeis sequence.

Quote:
Originally Posted by axn View Post
Using brute force exhaustive search (O(10^8)), I was able to find two solutions for n=15.
Quote:
Originally Posted by ramshanker View Post
Ok, found the 18 digit one.
Run-time 5967.29 sec.
etc. (other posts)

My timings in the low range: for
n value, timing in thread time on my ancient core-i3
n=15: <1 second
n=18: 2 seconds [to get *]
n=21: 61 seconds (close to the famous 1 minute rule) [to get **]
n<=30: 152 hours
R. Gerbicz is offline   Reply With Quote
Old 2016-04-04, 15:43   #20
ramshanker
 
ramshanker's Avatar
 
"Ram Shanker"
May 2015
Delhi

2·19 Posts
Default

Quote:
Originally Posted by R. Gerbicz View Post
The official solution (what is essentially my solution ) is out at: https://www.research.ibm.com/haifa/p...March2016.html
So we can send a write-up also about the solution? This is my first time participating in Ponder-This contest. I just mailed them the number from my O(10^(d/2)) implementation output.

I wrote mine in python, an interpreted language, so I guess (wild guess) I could achieve at least 5 times improvement in run time with C code. However lost my interest after that lucky (early in the search sequence) 21 digit solution. My Python code managed ~140k candidate numbers per second.

Last fiddled with by ramshanker on 2016-04-04 at 15:47
ramshanker is offline   Reply With Quote
Old 2016-04-04, 17:54   #21
R. Gerbicz
 
R. Gerbicz's Avatar
 
"Robert Gerbicz"
Oct 2005
Hungary

101110011002 Posts
Default

Quote:
Originally Posted by ramshanker View Post
So we can send a write-up also about the solution?
Yes, of course. Here I'm regularly posting solutions of the month puzzle (if I've solved).

Quote:
Originally Posted by ramshanker View Post
I wrote mine in python, an interpreted language, so I guess (wild guess) I could achieve at least 5 times improvement in run time with C code. However lost my interest after that lucky (early in the search sequence) 21 digit solution. My Python code managed ~140k candidate numbers per second.
In general Python is not that slow. And it is a little technique to avoid the somewhat costly squaring in most of the cases (my solution was in c).
R. Gerbicz is offline   Reply With Quote
Old 2016-06-09, 20:26   #22
R. Gerbicz
 
R. Gerbicz's Avatar
 
"Robert Gerbicz"
Oct 2005
Hungary

22·7·53 Posts
Default

The next term is a(28)=42438303108538316396992097393368 found by Dieter Beckerle using my posted algorithm, but his own code. And there is no more term up to 10^32. The oeis sequence is updated, now it is in draft. (https://oeis.org/A269588).

ps. Note that here still k=3, so there is a speedup of 1000 over the classical approach.
R. Gerbicz is offline   Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
March 2018 Xyzzy Puzzles 2 2018-04-08 13:45
March 2017 R. Gerbicz Puzzles 1 2017-04-03 10:57
March 2015 Xyzzy Puzzles 15 2015-04-02 02:19
March Madness 2006 Prime95 Lounge 20 2006-03-21 04:35
gmp 4.2 due in March Mystwalker GMP-ECM 4 2006-02-01 12:00

All times are UTC. The time now is 02:48.


Sat Jul 17 02:48:27 UTC 2021 up 50 days, 35 mins, 1 user, load averages: 1.30, 1.41, 1.43

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.