# Tag Info

0

I couldn't get the HorizontalGauge to work and resorted to using IntervalSlider for this problem after fixing the bug in my TrackingFunction. (Or rather, stumbling across a TrackingFunction that worked.) In my opinion, there's something fishy about passing List arguments in Manipulate

1

cf = Compile[{{m, _Integer}}, Do[ If[Abs[2^x - 5^y - 3] < 10.^-12, Print[{x, y}]], {x, 0, m}, {y, 0, m} ], CompilationTarget -> "C", RuntimeOptions -> "Speed" ]; cf // AbsoluteTiming {2,0} {3,1} {7,3} {0.171435,Null} Note that overflow will occur. Do[ With[{y = Log[5, -3 + 2^x]}, If[Abs[FractionalPart@y] < 10....

2

In version 10.1 this sort of works, but the sliders are sticky; I have to click once to move them rather than click-and-drag. I recall having this problem before (with Slider, not HorizontalGauge) but I cannot recall the cause or solution. How does this behave in whatever version you are using? ClearAll[h] h[d_, opt___] := Dynamic[HorizontalGauge[d, opt]] ...

6

This is an incomplete answer to a question that was not asked. One can show that there are no solutions in intervals in a way that is much faster than exhaustive search. I'll give the general idea but I'm not going to make a rigorous proof. First we rewrite by taking the base-2 logarithms of both sides. x = log_2(5^y+3) = log_2(5^y (1+3/5^y)) = y log_2(...

2

Clear["Global*"] eqn = 2^x == 5^y + 3; m = 2000; AbsoluteTiming[{#[], #[[-1, -1]]} & /@ (x /. Solve[{eqn, 0 <= x <= m, 0 <= y <= m}, x, Integers])] (* {2.3865, {{2, 0}, {3, 1}, {7, 3}}} *)

13

In version 10.1 on my circa 2011 PC: AbsoluteTiming[ M = 2000; r = Range[0, M]; xx = 2^r; yy = -(5^r); grid = # + yy & /@ xx; Position[Round@grid, 3] - 1 ] {3.3214, {{2, 0}, {3, 1}, {7, 3}}} By luck it seems in this instance Round isn't actually needed: AbsoluteTiming[ M = 2000; r = Range[0, M]; xx = 2^r; yy = -(5`^r); grid = # + yy &...

4

Slight variation of @Mr.Wizard solution. m = 2000; range1 = Range[0, m]; range2 = Range[0, Ceiling[Log[5, 2^m - 3]]]; AbsoluteTiming[Position[Outer[Plus, 2^range1, -5^range2], 3] - 1] {0.924582, {{2, 0}, {3, 1}, {7, 3}}} Original answer: This approach reduces time to ~20sec m = 2000; pts = Tuples[Range[0, m], 2]; slope1 = (Ceiling[Log[5, 2^m - 3] + ...

10

Maybe double loop is not necessary: Reap[Do[If[IntegerQ[Log[2, 5^y + 3]], Sow[y]], {y, 100000}]] Takes around 12 seconds.

Top 50 recent answers are included