Join us in building a kind, collaborative learning community via our updatedCode of Conduct.

Questions tagged [factorial]

In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n.

0
votes
1answer
19 views

How can I get past 33! using Javascript in Browser?

I know there must be a trick I am missing, how do I calculate past 33! using in browser JS? I have the following already, this gets me to 33 but blows up when I go to 34. I Got 34 to work in Node like ...
0
votes
0answers
16 views

Dynamic Approach to factorial of a number in java, giving NULLPOINTEREXCEPTIN [duplicate]

I developed this code to calculate the factorial in java by the dynamic approach. But it's throwing an exception NULLPOINTER, here is my code:public class test {int fact[];int ...
-1
votes
1answer
44 views

Factorial function only returning inputted answer in C++?

I have to create a program which calculates the factorial of any number, the problem is if I input any number above 20 it just returns that number. What in my else if statement could be causing this ...
0
votes
4answers
48 views

I want to take out Last Digit of Huge Number Stored in BigInteger In JAVA

import java.math.BigInteger;import java.util.Scanner;public class LastFact{// Returns Factorial of Nstatic BigInteger factorial(int N){// Initialize result...
1
vote
1answer
45 views

is there a page detailing incompatibilities between Julia versions

Is there a page or document describing incompatibilities between Julia versions? Specifically, things like factorial() and lfact() seem to have silently disappeared between the 0.6 and 0.7 ...
0
votes
1answer
15 views

Excel Shell() Args to/from Calc.exe

MS's new calculator can do non-integer (decimal) N! . Excel's internal calculator still only returns nearest integer value for FACT().In order to run non-integer hypergeometric and multinomial ...
0
votes
0answers
42 views

How to convert BigInteger to scientific notation [duplicate]

I am currently writing some code for a simple calculator, and I wanted to add on a factorial function to it.Since the numbers can get quite big, I used BigIntegers for the factorials. However, when ...
3
votes
2answers
87 views

Quick way to find a factorial of a large number

This is my program, but for really large numbers like 100,000, it works very slowly, is there any option to optimize?import java.math.BigInteger;import java.util.Scanner;public class Main {...
2
votes
3answers
51 views

Java Compute C(n,k) and factorial with biginteger

I want to compute the answer of C(n,k),such as C(10,2)=10*9/2*1=45If I test my code by small numbers like 10, the code works.However, when I try to compute C(1000,900), it compilesException in ...
2
votes
3answers
36 views

find Factorial of no. It is working fine but i am not able to understand why its giving me factorial 0 for no 56,89,77 and other some numbers

This is my code for factorial program. it is working fine but i am not able to understand why its giving me factorial 0 for no 56,89,77 and other some numbers.private static void factorial() {...
0
votes
1answer
38 views

Ruby - factorial / combinations using inject

I am trying to solve this combination (nCr) problem, which essentially boils down to factorials. Any help explaining why my approach doesnt work is helpful.. combination=-> (n) do-> (r) ...
0
votes
3answers
72 views

Number of trailing zeros of N [closed]

I am writing a method which calculates the number of trailing zeros in a factorial of a given number.For example:6!=720 --> 1trailing zero12!=479001600 --> 2 trailing zeroHere is ...
0
votes
0answers
39 views

php code error in executing

I have been learning php code a few weeks ago. I tried to run a simple code of finding factorial of a number. The code that I executed first was,<?php$sum=0;for($i=1;$i<=5;$i++){$...
-3
votes
2answers
40 views

Calculating permutations taking too much time

I am trying to generate 20! permutations and do some Logical operations on it. I switched to multiprocessing and as I increase the number of processes preportional to the number of cores the ...
3
votes
1answer
133 views

Inaccurate C++ factorial program

I wrote an implementation of the following tutorial: LINK Basically, since C/C++ does not have BIG Integer we are storing the factorial decimal values in an array. This is equivalent to writing a ...
-2
votes
1answer
66 views

How can we find big O notation for trailing zeros in factorial?

I know how to calculate big O notation for factorial but I am having difficulty combining both notations.this is the code for calculating trailing zeros.using namespace std;// Function to ...
1
vote
1answer
53 views

How to print all the digits in a large number of 10 power 25 in swift?

I have been working on a hacker rank problem where I have to print a number which is a factorial of 25. Here is the code I used.func extraLongFactorials(n: Int) -> Void {let factorialNumber=...
0
votes
1answer
43 views

factorial trailing zeroes BigO problems

when I submit to leetcode, it run case 500/502 but failed, reason: 1808548329. But when I run it on my own mac, it gave the same answer as the accepted one.my code :int trailingZeroes(int n) {...
0
votes
3answers
87 views

why using int64_t gives wrong result while double works as expected for simple integer multiplications

here is my code :using integer=int64_t;integer factorial(integer number) {return number <=0 ? 1 : number * factorial(number - 1);}integer binomial_coefficent(integer n, integer r) {...
0
votes
3answers
93 views

Printing out a list of factorials from (0 to n) in C

So I'm just starting to learn to code and maybe it's because I don't fully understand the nature of loops. So what I want the output to be is:If the inputted value is 6 for example, the program ...
0
votes
2answers
50 views

C - My scanf never stops taking inputs

So, I was messing around a little bit with loops when I thought it would be a nice idea to try and make a simple factorials calculator. This is the code:#include <stdio.h>int main(int argc, ...
2
votes
2answers
68 views

How Can Print a Visualization to Factorial of a Number with Recursion

I know how to calculate the factorial of a number, but I want to display what's going on in memory as the method calls itself. So the factorial using recursion is as fallowspublic static long ...
3
votes
2answers
98 views

How can I make my factorial function reentrant?

I am supposed to write a reentrant factorial function, when I searched what a reentrant function is, I found many definitions, such as a reentrant function shouldn't use static or global variable,and ...
-6
votes
2answers
51 views

Error in Factorial Program in Python

When I execute the below code in Python 3, it's gives me below error. Could some one explain me what is wrong in the below code.I know how to write a Factorial Program using simple function. But I ...
-1
votes
1answer
39 views

Calculate the value of coshx using tailor series in cpp

I was assigned a task to calculate the value of coshx using tailor series in CPP.I tried a simple approach by using factorial and power function, but i noticed that at larger values of x the ...
-3
votes
2answers
87 views

recursive function that returns factorial C++

I am trying to solve at the following exercise from the C++ Primer Plus book.Define a recursive function that takes an integer argument and returnsthe factorial of that argument. Recall that 3 ...
0
votes
1answer
33 views

how to draw with matlab two seprate graphs with loglog?

i am trieng to draw with matlab the two functions :y1=ln(n!) and y2=ln(n)*n when n is a vector like this : n=1:100i want to draw both of these functions in the same graph , and then draw another ...
0
votes
4answers
52 views

Factorial - unresolved compilation, must return a result of type int [duplicate]

import java.util.Scanner;public class Factorial{public int factorial(int n){ if(n==1){ return 1;}while(n>1){return(n*...
2
votes
2answers
66 views

Complexity of f(k) when f(n)=O(n!) and k=n*(n-1)

I have the following problem. Let's suppose we have function f(n). Complexity of f(n) is O(n!). However, there is also parameter k=n*(n-1). My question is - what is the complexity of f(k)? Is it f(k)=...
1
vote
2answers
91 views

confusing concurrency and performance issue in Go

now I start learning Go language by watching this great course. To be clear for years I write only on PHP and concurrency/parallelism is new for me, so I little confused by this.In this course, ...

153050per page
angop.ao, elkhabar.com, noa.al, afghanpaper.com, bbc.com, time.com, cdc.gov, nih.gov, xnxx.com, github.com,