Post Reply 
Perfect NumBer.
04-02-2016, 11:26 AM
Post: #1
Perfect NumBer.
Hi,

I submit a new little routine wich give if a number is perfect, ie equal to it's propers divisors :

6=1+2+3, 1+2+3=6 it is perfect number.
8=1+2+4, 1+2+4=7 it is not.
28=1+2+4+7+14 it is.

And so on.
Code:

01 LBL'PNB'
02 LBL A
03 LocR 001
04 # 000
05 INC X
06 [cmplx]ENTER
07 RCL+ X
08 x[<->] T
09 x<? T
10 SKIP 007
11 RCL Z
12 RMDR
13 RCL+ Z
14 x=? Z
15 STO+ .00
16 x[<->] Z
17 BACK 012
18 RCL .00
19 x[!=]? Y
20 CLSTK
21 RTN
22 END

Specials thanks to Didier and Dieter for good programming !


Good week-end.

Gérard.
Find all posts by this user
Quote this message in a reply
04-02-2016, 11:27 AM
Post: #2
RE: Perfect NumBer.
If you see the number entered then it is a perfect number.
If you see zero it is not.

Gérard.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)