The Museum of HP Calculators


Euler Function for the HP-65

This program is Copyright © 1974 by Hewlett-Packard and is used here by permission. This program was originally published in the HP-65 Math Pac 2.

This program is supplied without representation or warranty of any kind. Hewlett-Packard Company and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.

Card Labels

Euler Function Jn(x)

Label

phi(n)

   

   

   

   

Key

A

B

C

D

E

Overview

phi(n) is the number of integers not exceeding and relatively prime to n, where n is a non-negative integer.

Suppose

          n = p1m1p2m2. . . pkmk

where Pi (i = 1, 2, ..., k) are distinct primes dividing n, then

          phi(n) = n PIi=1..k(1-1/pi)

                    = PIi=1..k(pimi - pimi-1)

Instructions

Step

Instructions

Input Data/Units

Keys

Output Data/Units

1

Enter Program

     

2

 

 n

A

phi(n) 

Examples

1. phi(30) = 8.00
2. phi(251) = 250.00

The Program

 CODE  KEYS
   23  LBL
   11  A
33 01  STO 1
   01  1
33 02  STO 2
33 04  STO 4
   02  2
33 03  STO 3

   23  LBL
   01  1
34 01  RCL 1
34 03  RCL 3
   81  ÷
34 03  RCL 3
35 24  g x>y
   22  GTO
   02  2
35 08  g roll dn
   31  f
   83  INT
35 00  g LST X
35 24  g x>y
   22  GTO
   03  3
33 01  STO 1
34 04  RCL 4
34 03  RCL 3
33 04  STO 4
35 21  g x!=y
   01  1
   51  -
   33  STO 
   71  x
   02  2
   22  GTO
   01  1

   23  LBL 
   03  3
   02  2
34 03  RCL 3 
35 23  g x=y
   44  CLX
   01  1
   61  +
33 03  STO 3
   22  GTO 
   01  1

   23  LBL 
   02  2 
34 04  RCL 4
34 01  RCL 1
35 21  g x!=y
   01  1
   51  -
34 02  RCL 2
   71  x 
   24  RTN
35 01  g NOP 
35 01  g NOP 
35 01  g NOP 
35 01  g NOP 
35 01  g NOP 
35 01  g NOP 
35 01  g NOP 
35 01  g NOP 
35 01  g NOP 
35 01  g NOP 
35 01  g NOP 
35 01  g NOP 
35 01  g NOP 
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP
35 01  g NOP

Register Use

R1  used
R2  used
R3  used
R4  used
R5  
R6  
R7  
R8  
R9  used

Go back to the software library
Go back to the main exhibit hall