[math-fun] Detecting binomial coefficients
Suppose we are given the prime factorization of a rather large integer Q. Is there a good algorithm for determining from this whether the number Q is a binomial coefficient? I.e., whether there exist positive integers k < n such that Q = n! / (k! (n-k)!) . —Dan
hello mr Asimov, that's a good question, there are a number of ways, the factors of binomials always have a definite pattern, 1- first approach would be : by the size of Q, we can restrict the search to a given index. 2- we know also that the factors would be small in size, so the factoring of Q should be simple to do. 3- Once we have the list of factors, from 2 to m (m being the biggest prime), then we also know that the list from 2 to m has to be without holes in the list of primes. That does not solve it but at the least limits the number of cases to verify. Best regards, Simon Plouffe There Le 2017-01-07 à 01:30, Dan Asimov a écrit :
Suppose we are given the prime factorization of a rather large integer Q.
Is there a good algorithm for determining from this whether the number Q is a binomial coefficient?
I.e., whether there exist positive integers k < n such that
Q = n! / (k! (n-k)!)
.
—Dan
_______________________________________________ math-fun mailing list math-fun@mailman.xmission.com https://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
There's an excellent algorithm. Constant time. Print "Yes." Did you want to restrict the question more, perhaps? On Fri, Jan 6, 2017 at 4:30 PM, Dan Asimov <dasimov@earthlink.net> wrote:
Suppose we are given the prime factorization of a rather large integer Q.
Is there a good algorithm for determining from this whether the number Q is a binomial coefficient?
I.e., whether there exist positive integers k < n such that
Q = n! / (k! (n-k)!)
.
—Dan
_______________________________________________ math-fun mailing list math-fun@mailman.xmission.com https://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
-- -- http://cube20.org/ -- [ <http://golly.sf.net/>Golly link suppressed; ask me why] --
Q = binomial(Q,1). -- Gene From: Dan Asimov <dasimov@earthlink.net> To: math-fun <math-fun@mailman.xmission.com> Sent: Friday, January 6, 2017 4:30 PM Subject: [math-fun] Detecting binomial coefficients Suppose we are given the prime factorization of a rather large integer Q. Is there a good algorithm for determining from this whether the number Q is a binomial coefficient? I.e., whether there exist positive integers k < n such that Q = n! / (k! (n-k)!) . —Dan _______________________________________________ math-fun mailing list math-fun@mailman.xmission.com https://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
(I think Dan meant a “non-trivial” binomial. But you knew that.)
On Jan 6, 2017, at 5:10 PM, Eugene Salamin via math-fun <math-fun@mailman.xmission.com> wrote:
Q = binomial(Q,1).
-- Gene
From: Dan Asimov <dasimov@earthlink.net> To: math-fun <math-fun@mailman.xmission.com> Sent: Friday, January 6, 2017 4:30 PM Subject: [math-fun] Detecting binomial coefficients
Suppose we are given the prime factorization of a rather large integer Q.
Is there a good algorithm for determining from this whether the number Q is a binomial coefficient?
I.e., whether there exist positive integers k < n such that
Q = n! / (k! (n-k)!)
.
—Dan
_______________________________________________ math-fun mailing list math-fun@mailman.xmission.com https://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
_______________________________________________ math-fun mailing list math-fun@mailman.xmission.com https://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
Slightly less trivial case (?): If p is safe prime (A5385) then binomial (p, p - 2) is the product of two primes p and (p-1)/2 (semiprime A1358) .
Суббота, 7 января 2017, 5:53 +03:00 от Marc LeBrun <mlb@well.com>:
(I think Dan meant a “non-trivial” binomial. But you knew that.)
On Jan 6, 2017, at 5:10 PM, Eugene Salamin via math-fun < math-fun@mailman.xmission.com > wrote:
Q = binomial(Q,1).
-- Gene
From: Dan Asimov < dasimov@earthlink.net > To: math-fun < math-fun@mailman.xmission.com > Sent: Friday, January 6, 2017 4:30 PM Subject: [math-fun] Detecting binomial coefficients
Suppose we are given the prime factorization of a rather large integer Q.
Is there a good algorithm for determining from this whether the number Q is a binomial coefficient?
I.e., whether there exist positive integers k < n such that
Q = n! / (k! (n-k)!)
.
—Dan
_______________________________________________ math-fun mailing list math-fun@mailman.xmission.com https://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
_______________________________________________ math-fun mailing list math-fun@mailman.xmission.com https://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
_______________________________________________ math-fun mailing list math-fun@mailman.xmission.com https://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
I assume you mean to decide if Q = (n choose k) for some k, n with 1 < k < n. And by "good algorithm", I assume you mean runtime bounded by time polynomial in Q. Even more is true: not only can you tell whether this is solvable, but you can also list all (n,k) pairs, in polynomial time. And you don't need the prime factorization of Q. We can assume in (n choose k) that n >= 2k; if not replace k by n-k. Then Q = (n choose k) >= (2k choose k) ~ 4^k/sqrt(Pi*k) So k is clearly bounded above by c log_2 Q for some small c around 2, so we can simply try k = 2, 3, ..., c log_2 Q and then use binary search to solve Q = (n choose k) for n, for each individual k. This would make a nice first exercise for a course in algorithmic number theory. But perhaps you mean that Q is given in compressed form as p_1^{e_1} ... p_j^{e_j} with p_1 < .... < p_j and you want to do it time polynomial in the logs of all p_i and e_i? In that case more work is needed. First, unless k is relatively small, n will be between p_j and the next prime after p_j. Assuming Cramer's conjecture, this restricts n to a relatively small range, something like [p_j, p_j + (log p_j)^2]. So we can simply test each n in this range and determine the possible k using numerical estimates on the logs. Finally, we can get the prime factorization of (n choose k) for this n and this k, using Legendre's formula and compare to the given list. I think this should work. On 1/6/17 7:30 PM, Dan Asimov wrote:
Suppose we are given the prime factorization of a rather large integer Q.
Is there a good algorithm for determining from this whether the number Q is a binomial coefficient?
I.e., whether there exist positive integers k < n such that
Q = n! / (k! (n-k)!)
.
—Dan
_______________________________________________ math-fun mailing list math-fun@mailman.xmission.com https://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
participants (7)
-
Dan Asimov -
Eugene Salamin -
Jeffrey Shallit -
Marc LeBrun -
Simon Plouffe -
Tomas Rokicki -
Zak Seidov