33S: nCr weirdness


I newly acquired a hp 33S, and tested its speed for nCr operation. I entered the following:

2000 Enter 1000 nCr

and the calculated result : 1.8099e499

I compared with my 32SII. To my surprise, my 32SII showed an Overflow message and displayed 1e500. My 48G displayed 9.999e499. Apparently, the result of 33S is strange. I continued increasing the value, everytime keeping r=n/2, and see how large the number goes before it gives an overflow message, and the result:

2000C1000 = 1.8099e499

3000C1500 = 1.7674e499

5000C2500 = 2.000e499

7000C3500 = 2.2301e499

8994C4497 = 9.9827e499

8995C4497 = Overflow = 1e500

So the largest value for n without getting an overflow message is 8994, with r=n/2=4997. IN all cases, the 32SII gave overflow message. Does anybody have any idea what happens with this nCr operation?

MY second question: I examined my equation library of 33S, and found the following equation preinstalled at the time of buying: V=.25pi d^2 l. This is the equation explained by the 33S manual. Does anybody also have such equation in their 33S? My serial: CNA4110.



KC wrote:

>... a hp 33S, and tested ...
>2000 Enter 1000 nCr
>and the calculated result : 1.8099e499
>... my 32SII showed an Overflow message and displayed 1e500

E.g. Mathematica shows:

N[Binomial[2000, 1000]]


which is also shown on calculators which allow greater exponents than 10^499.

Whereas the old 32SII and 48G give correct answers (Overflow), the new 33S has obviously a problem with the nCr implementation, or, in other words, there is a bug.

Many greetings from Hamburg,



Try it on a 49G and you'll get all the digits...



The same with the 48 with Erable...








Based on the combination formula:

nCr = n!/[(n-r)!*r!]

I wrote a 33S program based on the following: If we write it out sort of longhanded:

nCr = [(n)(n-1)(n-2)...(n-r+1)(n-r)(n-r-1)...(1)]/[(n-r)(n-r-1)...(1)*(r)(r-1)(r-2)...(1)]

There are terms on the numerator and denominator that cancel leaving us with:

nCr = [(n)(n-1)(n-2)...(n-r+1)]/[(r)(r-1)(r-2)...(1)]

If these terms are done separately, you can be dividing while multiplying individual terms thus preventing an overflow condition on relatively small values of n and r. I can write the program listing for anyone interested, but I doubt anyone is. Anyway, here are the results:

1600C800 = 8.8676E479

1650C825 = 9.8316E494

1660C830 = 1.0037E498

1662C831 = 4.0125E498

1664C832 = 1.6040E499

1666C833 = 6.4122E499

1668C834 = 1.0000E500(?)

1700C850 = OVERFLOW

The results from the built-in combination formula differ from mine starting at 1666C833 where the calculator's built-in gets 1.6021E499 as a result (which seems to be a bit low).

My 33s also had the same formula pre-loaded in the equation library. (just got it yesterday, S/N CNA4130XXXX)

Anyway, I was bored and thought this would be a good excuse to write a program for my new 33s. I'll have to compare results with my old 32SII.

James McF.


Here's another 33s weirdness. You can calculate an even root of a negeative number, as discussed elsewhere in this forum, using complex operations. This leaves the real part in the x-register and the imaginary part in the y-register. I wrote a small program to do this similar to others that have been posted:

C0001 LBL C

C0002 RPN ;Just to be sure

C0003 0

C0004 X<>Y


C0006 RTN

Given a negative number in the y-register and a fractional exponent in the x-register, say -4 and .5 this returns the correct square root, 0 in the x-register and 2 in the y-register representing the complex number 0+2i in rectangular form. The weirdness comes when you try to convert this to polar form using the ->theta,r key. If I just type 2 <enter> 0 ->theta,r I get the expected result, magnitude 2 and angle of 90 deg. But if I perform the same operation on the result of the complex operation, seemingly the same x=0,y=2 oredered pair, I get a magnitude of 2, which is expected, but at an angle of 270 deg which is very unexepected. Normally for any ordered pair on the stack the range of theta is -180 < 0 < 180 which makes the result of 270 deg even stranger. If I run the reverse ->y,x operation on the result I get y=-2 and x=0 which would be expected from an angle of 270 deg. Performing another ->theta,r gives the expected result of r=2 and theta=-90 deg (as opposed to 270 deg as before). I'm sure this is due to the algorithm used to compute the angle and its determination of the sign of the angle, but the result seems to imply that the calculator knows that it is working on a complex number, or at least that the number in the y-register is not a normal number. I didn't think there were different data types allowed on the stack of the 33s. Is there an undocumented flag or something that indicates a complex stack? I was under the assumption that the complex key just caused the stack to be treated as a pair of complex numbers for that particular operation but the numbers in the actual stack levels are still just real numbers. In any case the angle of 270 deg outside the normal range of the function and is weird!

Virgil Taylor


KC wrote:

[...] found the following equation preinstalled at the time of buying: V=.25pi d^2 l.
Same here. And vars D, L, V and W had non-zero values :-)


Am I missing something?

Are you writing d^21 or d^2 x L? Because d^21 is certainly not going to give you the volume of anything.

Mine has the preloaded equation as written in my subject line. I believe it is there as a "training" tool for those who work through the exercises in the manual.

Take care.



I didn't noticed a pre-loaded equation. Maybe I erased following the steps in the "getting started" section.

Possibly Related Threads...
Thread Author Replies Views Last Post
  HP-97 Weirdness Nick Taylor 1 284 07-26-2012, 04:17 PM
Last Post: Randy
  15c: Need good programs for Mod, nCr, nPr Dave Britten 55 3,425 09-15-2011, 08:48 PM
Last Post: Gerson W. Barbosa
  HP-300s cannot do nCr for many allowable values DeboT 21 1,393 10-31-2010, 11:10 AM
Last Post: Eddie W. Shore
  HP 20B Prediction weirdness? Joao S Veiga (Brazil) 22 1,440 05-14-2010, 09:30 PM
Last Post: Vieira, Luiz C. (Brazil)
  HP 35s keyboard weirdness Hiawatha Wheelwright 6 646 01-12-2010, 05:02 AM
Last Post: Bart (UK)
  48G keyboard weirdness Lincoln 5 518 01-10-2010, 03:09 PM
Last Post: Vieira, Luiz C. (Brazil)
  Bug in HP 20b: nCr with non-integer r Thomas Klemm 19 1,420 04-02-2009, 10:17 PM
Last Post: Paul Dale
  HP41 card reader weirdness Les Wright 6 581 01-28-2007, 05:12 PM
Last Post: plasmoid
  Integration Times "Old" 33s vs "New" 33s John Smitherman 21 1,535 12-14-2005, 12:04 AM
Last Post: Karl Schneider
  HP 41CV Weirdness - Sort of Long Wayne Stephens 4 462 05-03-2004, 10:55 AM
Last Post: Diego Diaz

Forum Jump: