3
$\begingroup$
FindInstance[
 298973528525.436 < 10^10*(n - k*3.32192809488736) < 298973528539.862,
 {n, k}, Integers
]

Result is: {{n -> 7507853441837, k -> 2260089089033}}

Checking these two integers in the expression between the inequality signs gives 298974609375, which satisfies the left inequality but not the right one. Is it because of limitations surrounding the size of numbers?

This all arose in my effort to find the smallest power of 2 that begins with 9 nines. To begin with 1 nine, the power needed is 53; to begin with 2 nines, the power has to be 93; 3 nines, power 2621; 4 nines, power 13301; 5 nines, power 254370; and so on. I suspect for the number to start with 9 nines the power will be in the trillions or higher. Values I used: 2^29.8973528526=999999999 and log(base 2) of 10 is 3.32192809488736

$\endgroup$
  • $\begingroup$ What if you split the inequality into two with &&? Also, why not use the exact values, like Log2[999999999]? $\endgroup$ – J. M. will be back soon Apr 23 '16 at 4:13
  • $\begingroup$ I tried both things you recommend and it did not help. I'm beginning to feel that FindInstance is seriously flawed. It works well for me sometimes - and then leaves me scratching my head on other occasions. $\endgroup$ – Bob Kadylo Apr 23 '16 at 4:21
  • 1
    $\begingroup$ My way of thinking with "heuristic" functions such as FindInstance[] goes like this: if it comes up with something, wonderful! If it doesn't, it just means I have more legwork to do. $\endgroup$ – J. M. will be back soon Apr 23 '16 at 9:24
  • $\begingroup$ That is an excellent way to look at it. $\endgroup$ – Bob Kadylo Apr 23 '16 at 20:43
4
$\begingroup$

Do not despair!

eq1 = SetPrecision[298973528525.436 < 10^10*(n - k*3.32192809488736), 50];
eq2 = SetPrecision[10^10*(n - k*3.32192809488736) < 298973528539.862, 50];
sol = FindInstance[eq1 && eq2, {n, k}, Integers]

(* {{n -> 1702347304068985, k -> 512457601562468}} *)

{eq1, eq2} /. sol
(* {{True, True}} *)
$\endgroup$
  • $\begingroup$ This certainly adds to my faith in Mathematica and shows us how to 'tweak' results out of FindInstance[]. This particular value of n, although it satisfies my conditions, is not the SMALLEST possible exponent of 2 that results in a number starting with 9 nines. That distinction belongs to an 11 digit candidate, apparently. I need to do more "legwork" to see how Mathematica can give me that. Your answer sets me off on another journey of learning to gain a deeper understanding - Thank You. $\endgroup$ – Bob Kadylo Apr 23 '16 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.