All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Just Math
250th to the right of decimal (Posted on 2025-02-09) Difficulty: 3 of 5
             1020
N = ----------------------
    999999999989999999999
Find the 250th digit to the right of the decimal point.

No Solution Yet Submitted by Danish Ahmed Khan    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Computer Solution | Comment 3 of 5 |
Computer program essentially reproduces the results of long division, provided that the divisor and dividend are integers.

Program output (40 dec places per line):
0.1000000000010000000001100000000021000000
  0013100000000341000000016510000000506100
  0000215710000007218100000287891000010097
  0100003888611000139856210005287173100192
  7279410072144525102648724661098631771713
  6350423782349821954959848643331948308388
  2793317272
The 250th digit to the right of the decimal point is 2
 
----------
def large_divide_prec(divisor,dividend,prec=100):
    """ divisor & dividend must be integers  """
    dsr = divisor
    dnd = dividend
    whole_part = dnd//dsr
    dnd = dnd - whole_part*dsr
    ans = str(whole_part)
    # dsr is now greater than dnd
    quot = ''
    dnd *= 10
    for iter in range(prec):
        if dsr > dnd:
            quot += '0'
            dnd *= 10
        else:
            quot += str(dnd // dsr)
            dnd = (dnd % dsr)*10
    return ans + '.' + quot

print(large_divide_prec(999999999989999999999,10**20, 250))

print('The 250th digit to the right of the decimal point is',
      large_divide_prec(999999999989999999999,10**20, 250)[-1])

  Posted by Larry on 2025-02-09 11:18:08
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (7)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2025 by Animus Pactum Consulting. All rights reserved. Privacy Information