The Museum of HP Calculators

HP Forum Archive 19

[ Return to Index | Top of Index ]

Fun with the Casio fx-180p / fx-3600p
Message #1 Posted by Thomas Radtke on 13 Aug 2009, 10:25 a.m.

Recently, I shot a Casio 9850GB+ on a "different" aucion site for cheap. After playing with it for some _minutes_, I decided to put it up on eBay and asked myself, when was the last time I've been amazed by a Casio calculator. Well, it probably was when the fx-180p came out. Since then I wrote a lot of programs for it.

Today, I pulled a 3600p (one brother of the 180p) out of my drawer and found it still kept a program in memory that does something interesting. Took me quite some time to find the flow chart to this program. My question is, how would you solve the following problem on either the 180p or the 3600p (probably the programming model on the rare 190p is the same, so you can use it, too):

For any x >= 0, find the smallest y >= x that is the square of an integer.

E.g., for 0, the calculator should return 0. For 5, it should find 9

You likely have to use both P1 and P2.

Hope some of you are owning one of these wonderfull calculators and enjoy programming as mch as I do!

      
Re: Fun with the Casio fx-180p / fx-3600p
Message #2 Posted by Chuck on 13 Aug 2009, 1:52 p.m.,
in response to message #1 by Thomas Radtke

Unfortunately I don't have one of those calculators, but I did get an FX-9860G slim yesterday; first casio I've ever had. On this, I created the function Y1=(Intg(-sqrt(x))^2. The "Intg" is the greatest integer function, and so should work on any calculator that has this function. Just not sure how to impliment it on the aforementioned calculators. :(

CHUCK

            
Re: Fun with the Casio fx-180p / fx-3600p
Message #3 Posted by Thomas Radtke on 13 Aug 2009, 2:50 p.m.,
in response to message #2 by Chuck

Thank you for your interesting answer, Chuck! It's a nice idea to use the floor function on a negative number. Unfortunately, the old Casios don't have any of those integer functions, so a loop has to be considered. The problem is to keep it inside the 38 steps limit of these calculators. In addition, they offer very limited branching capabilities. And of course, you're typing in programs blindly.

Edited: 13 Aug 2009, 2:53 p.m.

      
Re: Fun with the Casio fx-180p / fx-3600p
Message #4 Posted by Xerxes on 13 Aug 2009, 6:34 p.m.,
in response to message #1 by Thomas Radtke

A solution in 9 steps on the FX-3900Pv with the same programming model but with an editor and 300 steps in four areas:

P1: Min 1 +/- M+ +
P2: 1 + x^2 x<=M
            
Re: Fun with the Casio fx-180p / fx-3600p
Message #5 Posted by Thomas Radtke on 14 Aug 2009, 1:51 a.m.,
in response to message #4 by Xerxes

Quote:
A solution in 9 steps on the FX-3900Pv with the same programming model but with an editor and 300 steps in four areas:
I have a 180p Plus, which must be a close relative to your 3900Pv. Unfortunately, none of these "late successors" seem to be able to handle fractions.

Quote:
P1: Min 1 +/- M+ +
P2: 1 + x^2 x<=M

Much shorter than my program, thank you, Xerxes!

But there's a way to calculate it faster. For x = 1000001, my solution appears within a second, while your program takes about 30 seconds on the 180p Plus.

Any other solutions? :-)

Edited: 14 Aug 2009, 9:32 a.m.

                  
Re: Fun with the Casio fx-180p / fx-3600p
Message #6 Posted by Xerxes on 14 Aug 2009, 1:34 p.m.,
in response to message #5 by Thomas Radtke

An even shorter version with 8 steps:

P1: Min 1 M- -
P2: 1 + x^2 x<=M

or 7 steps only, if x=0 is excluded:

P1: Min 1 M-
P2: 1 + x^2 x<=M

and a very fast solution with 14 steps excluding x=0:

P1: Kin1 Min 1 M- Kout1 SQR FIX0 RND NORM -
P2: 1 + x^2 x<=M
                        
Re: Fun with the Casio fx-180p / fx-3600p
Message #7 Posted by Thomas Radtke on 14 Aug 2009, 3:51 p.m.,
in response to message #6 by Xerxes

Quote:
and a very fast solution with 14 steps excluding x=0:

P1: Kin1 Min 1 M- Kout1 SQR FIX0 RND NORM -
P2: 1 + x^2 x<=M


Excellent :-)

This is my solution, not optimized in any way but fast and includes 0:

P1: kin1 sqrt - .5 = kin2 fix0

P2: kout2 + .5 = kin2 kout1 - kout2 rnd x^2 = x>0 kout2 rnd x^2 nrm

      
Re: Fun with the Casio fx-180p / fx-3600p
Message #8 Posted by Xerxes on 14 Aug 2009, 9:06 p.m.,
in response to message #1 by Thomas Radtke

Quote:
(probably the programming model on the rare 190p is the same, so you can use it, too)

Due to the lack of the K vars, only the short solutions are usable on the FX-190/191.

The FX-180P was my first programmable bought in 1980, so thank you for the fun with the powerful keystroke dialect of this calculator. ;-)

            
Re: Fun with the Casio fx-180p / fx-3600p
Message #9 Posted by Thomas Radtke on 15 Aug 2009, 7:38 a.m.,
in response to message #8 by Xerxes

Quote:
The FX-180P was my first programmable bought in 1980, so thank you for the fun with the powerful keystroke dialect of this calculator. ;-)
It was also my first programmable :-). Thanks for participating!


[ Return to Index | Top of Index ]

Go back to the main exhibit hall