Ruud H.G. van Tol on Sat, 26 Nov 2022 13:18:29 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
binomial() challenge (+thanks)
|
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: binomial() challenge (+thanks)
- From: "Ruud H.G. van Tol" <ruud.vantol@booking.com>
- Date: Sat, 26 Nov 2022 13:17:28 +0100
- Delivery-date: Sat, 26 Nov 2022 13:18:29 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=booking.com; h=message-id : date : mime-version : to : from : subject : content-type : content-transfer-encoding; s=pp; bh=1n5P2B3G3MxuqrF40ilycCy4Pz+teHzGAowWY9LtyBM=; b=Cd2KErYEUr6avyd88h3hJetYN0ihg++0QfR6L0DYBvoezWopDq2Naa2PGCDRSWCZq3k0 OaWL19vy1+IzLytEpS6+gntg43ahv9uX038Wji8Q5ZabZadqDmcLiKv8W5DdhTTlJM4s vRVeytNK3b3U5d7yMGSaqRNvnMpxmlotfnZI2uemWpbqHM7xx544M8xQqMPjGYm3mAzq FpjWVU4DExNLQ/ZMjMy2jW0kXRpYQ9+/scPlnGL8K97tMPBgXMZZ/wl7gfqMoOGBi/RY fDMe//35aHd9kEM9qNqUQpNibVXHOiB7XJYzEkHFTsadw4FKLgRCxlP4hZHg7kesAZYz QA==
- Organization: Booking.com
- User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.5.0
PARI binomial() challenge:
binom_1(n,k) = gamma(n+1) / gamma(k+1) / gamma(n-k+1)
binom_2(n,k) = exp(lngamma(n+1) - lngamma(k+1) - lngamma(n-k+1))
? version()
%12 = [2, 15, 1]
? 1.0* binomial(2^55,43)
%13 = 1.4282133046347667042864235447599552118 E659
? 1.0* binom_1(2^55,43)
%14 = 1.4282133046347667042864235447599552118 E659
? 1.0* binom_2(2^55,43)
%15 = 1.4282133046347667042944763056801257481 E659
and then
? 1.0* binomial(10^40,43)
%16 = 1.6552108677421951886982956337138493958 E1667
? 1.0* binom_2(10^40,43)
%17 = 7.416480782428988905 E1778
Also: with slightly higher-n, the UDFs fail.
So it looks to me, that always using binomial(),
so never even consider using an alternative,
is simply the right way. Thanks for that! :)
-- Ruud