It was specific to the 50G:

**HHC 2009 Programming Challenge**

Finding partial sums of rows of Pascal's Triangle

1

1 1

1 2 1

1 3 3 1

1 4 6 4 1

etc.

Write an HP50g program which takes a positive integer **n** of any size in level 2 and any integer **r** in level 1 and returns the sum of C(n,0) + C(n,1)+...+C(n,r) to level 1. The output should be 0 for **r**<0 and 2^{n} for **r** >= **n**.

The program will be transferred from your HP50g to the judges' HP50g and will be tested (in exact mode) for a selection of values of **n** and **r** chosen by the judges. The fastest program wins.

The usual rules apply:

- The program must be in user code only

- The program must be self-contained

- The program must leave the stack unchanged except for replacing **n** and **r** with the result.

- Default flag settings are assumed, except that RPN mode must be set. Flag settings must be restored if changed.

- The judgesâ€™ decision is final.