Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8907629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:58:00+00:00 2026-06-15T02:58:00+00:00

The factorial function could return a very large number as a result. How could

  • 0

The factorial function could return a very large number as a result.

How could I work out the size of the data which must return as a result of the factorial? Is there a function which can give me the size of the data quickly based upon the number n for which we are computing the factorial?

For example, factorial (5) = 5 * 4 * 3 * 2 = 120

The number 120 will be 120 = 0b1111000 where 0b indicates this is a binary number. At least, I need 7 bits to represent the result and probability I would like to fit that into 8 bits to be a byte.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T02:58:02+00:00Added an answer on June 15, 2026 at 2:58 am

    you need to calculate log2(factorial(N)), rounded up to the next higher number to get the number of bits you need to represent the result. if you’re not sure if your can calculate or represent the factorial result with your current setup, you may try to calculate the sum of log2(i) for all i in the range from 2 to N inclusive (including 2 and N, that is).

    as a sample, let’s calculate the number of bits for factorial(5):

    log2(120) = 6.906, rounded up become 7 (bits)
    

    otheriwise,

    log2(2) + log2(3) + log2(4) + log2(5) = 6.906, which gives same result
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to implement a function which when called return a factorial of
i want to find factorial a number which i take memory first.(intel 8085) edit:
I'm testing out user defined literals. I want to make _fac return the factorial
I am writing a very simple lisp code for the recursive factorial function. When
For instance, this is my factorial function: def fact(n): if n<=1: return 1 else:
say there is a function to calculate factorial(n) Does factorial(7) creates 7 function object
1I'm trying to make a limit-less factorial function (just out of curiosity.) This works
In Haskell in 5 steps the factorial function is defined as follows: let fac
I have defined ! (factorial) function and registered it as arithmetic function and an
I'm going crazy: Where is the Ruby function for factorial? No, I don't need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.