# hp 25

 more advanced than the hp-21, the 25 has two shift keys, orange and blue, the addition of statistics functions and its programmable. the deg/rad switch of the 21 is transformed into a prog/run switch whilst deg/rad and now grad are on keyboard. the mode is, however, lost when switched off along with the memory. 49 step programmable, no subroutines, but a comprehensive set of conditional branches. 7 memories. branch targets are step numbers rather than labels. this made sense with limited memory. it comes with a fur lined protective zipper pouch, owner's manual and a handy quick reference guide which can fit in the pouch for in-the-field use.

## example#1: moon phase program

calculation of the phase of the moon from the date.

 01 STO 1 02 3 03 R/S 04 x>=y 05 GTO 12 06 1 07 STO- 1 08 ROLL 09 1 10 2 11 + 12 1 13 + 14 3 15 0 16 . 17 6 18 * 19 INT 20 RCL 1 21 3 22 6 23 5 24. 25 2 26 5 27 * 28 INT 29 + 30 R/S 31 + 32 6 33 4 34 . 35 1 36 - 37 2 38 9 39 . 40 5 41 3 42 / 43 FRAC 44 8 45 * 46 . 47 5 48 + 49 INT calculate the phase of the moon to the nearest segment where 0 or 8 = new moon 1 = crescent (waxing) 2 = first quater (half moon) 3 = gibbous (waxing) 4 = full moon 5 = gibbous (waning) 6 = second quater (half moon) 7 = crescent (waning) Usage: enter the year since 1900 (eg 2002 is 102) R/S, then the month (1= jan) R/S, then the day R/S. Example: what is the phase of the moon for sunday, december 1, 2002. F PRGM (position to start) 102 R/S 12 R/S 1 R/S answer is: 7 soon to be a new moon.

## example#2: easter sunday program

given a year between 1900 and 2099, find the date of easter sunday.

 01 sto 1 02 1 03 9 04 / 05 frac 06 2 07 0 08 9 09 * 10 2 11 0 12 4 13 - 14 chs 15 3 16 0 17 / 18 frac 19 3 20 1 21 * 22 2 23 8 24 x<>y 25 x>=y? 26 gto 29 27 1 28 + 29 rcl1 30 5 31 * 32 4 33 / 34 int 35 sto2 36 + 37 7 38 / 39 int 40 7 41 * 42 rcl2 43 - 44 + 45 1 46 - Usage: enter the year (eg 2003) R/S if the anwer <= 31, easter falls on that date in march. otherwise easter falls in april. subtract 31 to give the april day. eg. what day for 2003. 2003 R/S 51 (ie april) 31 - gives april 20.

this program took me some time to develop. for a long time i thought the problem too complex to fit in less than 50 steps. the final result takes only 46 steps and derives from clever use of the formula:

```int easter(int y)
{
/* 1900 - 2099 */
int d;
d =(204 - 11*(y%19))%30;
if (d < 28) ++d;
return d+27-(5*y/4+d)%7;
}```