Prime factorization – Sharp EL-9900 User Manual

Page 40

Advertising
background image

3

Basic Keyboard/PROGRAMMING USING THE SHARP EL-9900

Copyright © 2002, Sharp Electronics Corporation. Permission is granted to photocopy for educational use only.

1.

Program the calculator to find the prime factorization of a whole number

greater than 2. This method decomposes a number into the prime factors

2, 3, 5, etc.

2.

Create a new program with the name DECOMP. Enter the following program

and remember to press ENTER at the end of each line. If you make a

mistake, use the calculator’s editing features to correct the error.

3.

Enter the following program using the Advanced Keyboard:

Input N

PRGM A 3 ALPHA N ENTER

2

⇒D

2

STO ALPHA

D ENTER

Label A

PRGM

B 0 1 ALPHA A ENTER

If (N

÷

D) = int

PRGM B 0 3 (

ALPHA N

÷

(N

÷

D) Goto B

ALPHA D )

ALPHA = MATH B 0 5

(

ALPHA N

÷

ALPHA D )

PRGM B 0 2

ALPHA B ENTER

D+1

⇒D

ALPHA D +

1 STO ALPHA

D

ENTER

If D

≤ √N Goto A

PRGM

B 0 3 ALPHA D MATH

F 6 2ndF

ALPHA N PRGM

B 0 2

ALPHA A ENTER

Goto C

PRGM B 0 2 ALPHA

C ENTER

Label B

PRGM B 0 1 ALPHA B ENTER

N

÷

D

⇒N

ALPHA N

÷

ALPHA D STO ALPHA

N ENTER

Print D

PRGM A 1 ALPHA D ENTER

Goto A

PRGM B 0 2 ALPHA

A ENTER

Label C

PRGM B 0 1 ALPHA C ENTER

Print N

PRGM A 1 ALPHA N ENTER

End

PRGM

A 6 ENTER

Press 2ndF QUIT to exit the editor.

PRIME FACTORIZATION

Advertising