mersenneforum.org  

Go Back   mersenneforum.org > Fun Stuff > Puzzles

Reply
 
Thread Tools
Old 2019-03-01, 16:01   #1
Xyzzy
 
Xyzzy's Avatar
 
"Mike"
Aug 2002

73×107 Posts
Default March 2019

http://www.research.ibm.com/haifa/po...March2019.html
Xyzzy is offline   Reply With Quote
Old 2019-03-01, 16:11   #2
uau
 
Jan 2017

79 Posts
Default

The "bonus question" part seems badly thought out. It seems to assume a particular value for n1. But the requirement is symmetrical for n1 and n2, and for the question to not be completely trivial, n1 and n2 must be different numbers (though that's not quite spelled out in the question). So even if there is a "simplest" answer, you can at least exchange n1 and n2.

And there actually are infinitely many possible answers. There only finitely many possible combinations of values for (BAT(x, N1), BAT(x, N2)). Thus infinitely many primes have the same combination, and thus there are infinitely many possible answers. I doubt all of those have some meaningful connection between BAT(sqrt(n1), 10000) and IBM.
uau is offline   Reply With Quote
Old 2019-03-04, 22:55   #3
uau
 
Jan 2017

79 Posts
Default

The question has been updated to clarify that it's the BAT values that must be primes, not the answer numbers. It's still true that there are infinitely many possible answers.
uau is offline   Reply With Quote
Old 2019-04-03, 13:47   #4
Xyzzy
 
Xyzzy's Avatar
 
"Mike"
Aug 2002

11110100000112 Posts
Default

http://www.research.ibm.com/haifa/po...March2019.html
Xyzzy is offline   Reply With Quote
Old 2019-04-04, 06:37   #5
Dieter
 
Oct 2017

2·72 Posts
Default solution

The solution is containing a little error: N2 = 1.76E10 and not 1.76E9
Dieter is offline   Reply With Quote
Old 2019-04-04, 07:13   #6
Dieter
 
Oct 2017

6216 Posts
Default solution

Searching and checking only numbers ni with BAT((sqrt(ni),10000) = 9100 from the beginning I had found immediately 53 and 477, but my "quadruple-precision floating point format" codes were not exact enough to compute BAT((sqrt(ni),N1) or BAT((sqrt(ni),N2).
So first of all I had to write routines for the octuple-precision floating point format (4 registers for one floating point number) (236 bits for the mantissa). Then I was able to see that
BAT((sqrt(53),N1) = BAT((sqrt(477),N1) and so on.
Dieter is offline   Reply With Quote
Old 2019-04-04, 16:32   #7
uau
 
Jan 2017

79 Posts
Default

Quote:
Originally Posted by Dieter View Post
my "quadruple-precision floating point format" codes were not exact enough to compute BAT((sqrt(ni),N1) or BAT((sqrt(ni),N2
You don't need floating point. In the case of square roots, the usual rational approximation algorithm works out so that all the intermediate values can be represented by small integers (you only get numbers of the form (sqrt(n) + a)/b, where a and b are below 2*sqrt(n)).


The code below demonstrates this. Note that it prints all optimal lower and upper bounds, not just optimal approximations.


Code:
#!/usr/bin/python3

n = 53
limit = 1e19

k = int(n**.5)
assert k**2 != n
e = 0
a, d, p = 0, 1, n
lb, ub = [0, 1], [1, 0]
while lb[1] < limit:
    print(('lower' if e == 0 else 'upper') + ' bounds:')
    i = (a+k)//d
    for _ in range(i):
        lb[0] += ub[0]
        lb[1] += ub[1]
        if lb[1] >= limit:
            break
        print(lb[0], '/', lb[1])
    a, d, p = i*d - a, p - i*(i*d -2*a), d
    assert a < (k+1) and d < 2*(k+1)
    lb, ub, e = ub, lb, 1-e

Last fiddled with by uau on 2019-04-04 at 17:06 Reason: simplify code
uau is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
January 2019 Xyzzy Puzzles 74 2019-04-09 13:34
March 2018 Xyzzy Puzzles 2 2018-04-08 13:45
March 2017 R. Gerbicz Puzzles 1 2017-04-03 10:57
March 2016 Xyzzy Puzzles 21 2016-06-09 20:26
gmp 4.2 due in March Mystwalker GMP-ECM 4 2006-02-01 12:00

All times are UTC. The time now is 09:43.

Tue Dec 1 09:43:04 UTC 2020 up 82 days, 6:54, 1 user, load averages: 1.94, 1.85, 1.71

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, 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.