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

Home > Numbers
Sawtooth Crossed Ratio Resolution (Posted on 2023-03-25) Difficulty: 3 of 5
Determine the value of:
{(2021)!/(2017)2}
Where, {x} = x - ⌊x⌋

Note: ⌊x⌋ denotes the floor function - that is, the greatest integer less than or equal to x.

*** Computer program assisted solutions are welcome, but an analytic solution is preferred.

See The Solution Submitted by K Sengupta    
Rating: 3.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Computer Solution Comment 3 of 3 |
For me, a straightforward calculation leads to a computer overflow error.
I used an algorithm that repeatedly subtracts (10^n)*2017^2 where n is the most zeros you can concatenate without making the number to be subtracted too large.
Once the numerator is small enough, then a simple division shows the result.
The final numerator was 4019881 which is 1993*2017

The solution to the problem is 0.9881011403073872 which is 1993/2017

-----------
def fac(n):
    """ Factorial """
    if n == 1 or n == 0:
        return 1
    else:
        return n*fac(n-1)

bigfac = fac(2021)
numerator = bigfac
while numerator > 4068289:
    snumer = str(numerator)
    length = len(snumer)
    start = int(snumer[:7])
    if start < 4068289:
        subtract = int('4068289' + '0'*(len(snumer)-8) )
    elif start >= 4068289:
        subtract = int('4068289' + '0'*(len(snumer)-7) )
    numerator -= subtract

print(numerator)
print(numerator/4068289)

Edited on March 25, 2023, 3:24 pm
  Posted by Larry on 2023-03-25 15:21:11

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 (6)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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