Fun with the Casio fx-180p / fx-3600p



#2

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!


#3

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


#4

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.

#5

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

#6

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.


#7

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

#8

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

#9

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. ;-)


#10

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!

Possibly Related Threads...
Thread Author Replies Views Last Post
  ENG button (like Casio calculators) on HP Prime uklo 3 883 11-04-2013, 09:45 PM
Last Post: LHH
  Fun graphs on HP Prime Mic 9 1,295 09-15-2013, 08:30 AM
Last Post: Eddie W. Shore
  [HP Prime] Request: re-execute history like CASIO classPAD serie 300/400 CompSystems 1 700 09-03-2013, 02:47 PM
Last Post: CompSystems
  OT: Does anyone have the new Casio Classpad fx-CP400? Eddie W. Shore 4 891 08-20-2013, 08:42 AM
Last Post: Eddie W. Shore
  Classpad II fx-CP400 emulator Namir 0 518 07-07-2013, 08:07 AM
Last Post: Namir
  Casio fx-CP400 emulator (90 days trial) Mic 2 960 05-16-2013, 01:07 PM
Last Post: critor
  Fun things found by running strings on the 39gII emulator bhtooefr 11 1,749 05-16-2013, 12:40 AM
Last Post: Mic
  OT: RPN port to Casio fx-cg10/20? Matt Kernal 4 916 04-30-2013, 12:16 PM
Last Post: hugh steers
  Casio fx-CP400 preorder for Europe ! Mic 3 791 12-08-2012, 01:02 PM
Last Post: Mic
  OMG : NEW Casio calculator with color !! Mic 23 2,625 11-29-2012, 01:27 PM
Last Post: Eddie W. Shore

Forum Jump: