![]() |
|
|
#1 |
|
"Rashid Naimi"
Oct 2015
Remote to Here/There
2·11·109 Posts |
Hi,
Is there a way to formulate the solution of minimization of: abs(n-2^x*3^y) Over integers x and y for any given integer n? A numeric example that I found by trial and error is: |6859-2^8*3^3|=53 Thanks in advance. |
|
|
|
|
|
#2 | |
|
"Forget I exist"
Jul 2009
Dartmouth NS
210D16 Posts |
Quote:
19^3-(2^8*3^3)=53 which allows if rational bases were allowed: ((19/3)^3-2^8)*3^3 =53 and then: ((19/3)^3-(2^(8/9))^9) *3^3=53 and then: ((19/3)^3-(2^(16/9))^3)*3^3=53 if you want to reduce to a difference of cubes times a cube. of course this relies on the factorization of n. we also probably have different opinions/ideas about what is minimized though. |
|
|
|
|
|
|
#3 |
|
"Forget I exist"
Jul 2009
Dartmouth NS
8,461 Posts |
I just realized you meant solving for x,y sorry brain asleep well we can turn it into :
n>=2^x * 3^y re-expression of n as a power of 2 is possible ( the power being at most x+log_2(3)*y ) and as a power of 3 ( the power being at most y+log_3(2)*x). edit: okay the >= is not technically true however the part you are subtracting can be turned into one power that you can possibly solve to x and y values on either side of 0 to try and equate to n. Last fiddled with by science_man_88 on 2016-07-10 at 01:25 |
|
|
|
|
|
#4 | |
|
"Rashid Naimi"
Oct 2015
Remote to Here/There
45368 Posts |
Quote:
I would state it as: n~2^x * 3^y x<=round(log_2(n)) y<=round(log_3(n)) Solving for one power, given the other is trivial. Solving for x & y both unknown is what I would like insight to. Last fiddled with by a1call on 2016-07-10 at 01:31 |
|
|
|
|
|
|
#5 |
|
"Forget I exist"
Jul 2009
Dartmouth NS
8,461 Posts |
technically there are two ( or even 3 once you break the >= case down) cases I've only shown one ( partly because I'm not sure I can phrase it).
Last fiddled with by science_man_88 on 2016-07-10 at 01:36 |
|
|
|
|
|
#6 |
|
"Rashid Naimi"
Oct 2015
Remote to Here/There
2×11×109 Posts |
I don't expect there to be a known solution for this. I am just looking for expert-confirmation or authoritative-reference on the subject.
Last fiddled with by a1call on 2016-07-10 at 04:01 |
|
|
|
|
|
#7 |
|
Jun 2003
10101010110002 Posts |
In a loop, look for all different powers of 3 from 0..y, and solve for the power of 2. Pick the one with smallest resultant difference. Even for numbers as large as 1000 digits, you'll have to check only about 2000 powers of 3. This is not a computationally difficult problem.
|
|
|
|
|
|
#8 | |
|
"Rashid Naimi"
Oct 2015
Remote to Here/There
2·11·109 Posts |
Quote:
You are correct, however I am not looking for a brute force type of a solution, rather a formulaic one. There can easily be prime related uses which can be computationally taxing. Say if you were to approximate a large factor using powers of a pool of primes. Last fiddled with by a1call on 2016-07-10 at 04:47 |
|
|
|
|
|
|
#9 | |
|
"Serge"
Mar 2008
San Diego, Calif.
1026910 Posts |
Quote:
Incidentally for any arbitrarily small |
|
|
|
|
|
|
#10 | |
|
"Forget I exist"
Jul 2009
Dartmouth NS
210D16 Posts |
Quote:
Last fiddled with by science_man_88 on 2016-07-10 at 12:43 |
|
|
|
|
|
|
#11 |
|
"Forget I exist"
Jul 2009
Dartmouth NS
8,461 Posts |
if r=N/(6^(floor(log_6(N)))) then you can say that x=floor(log_6(N))+{ 0 if r is not in ranges 2-3 or 4-5}{1 if in range 2-3}{2 if in range 4-5} ; y= floor(log_6(N)) +{0 if r is not in range 3-4} {1 otherwise} with at most one of these increasing one more to cover the value above N that could lead to a lower absolute value.
Last fiddled with by science_man_88 on 2016-07-10 at 15:33 |
|
|
|
![]() |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| k*b^n+/-c where b is an integer greater than 2 and c is an integer from 1 to b-1 | jasong | Miscellaneous Math | 5 | 2016-04-24 03:40 |
| Minimize maximum error | Joshua2 | Homework Help | 10 | 2011-03-15 13:19 |
| Always an integer. | mfgoode | Puzzles | 18 | 2007-07-13 18:03 |
| Integer FFT | nevarcds | Math | 4 | 2004-07-28 19:14 |
| Good way to minimize factoring algoritm twice? | HiddenWarrior | Math | 7 | 2004-03-10 13:39 |