Post Reply 
STOP in 34s
11-30-2015, 10:38 AM
Post: #1
STOP in 34s
Hi,

While I was playing with Stop instruction (R/S), I was despite by this :

Code:

.
.
.
.
X=? Z
STOP   ; If test true to display X
0
STO 02  
GTO'MPG' ; If test false do theses 3 step
END

In run mode I obtain *diplay X* if test true so I press R/S to 'CONT' program : ok 0 is stored in Reg 02 but alas, if I look program I am always with 0 STO 02 and not to the beguinig of my program ?

If the test is false, 0 is stored in Reg 02 and the same, and not GTO to fLBL'PGM'

Really I don't understand ! Why not going to step 001 ?

And because I've merged programs by XEQ it don't run.

Good day.

Gérard.
Find all posts by this user
Quote this message in a reply
11-30-2015, 06:56 PM
Post: #2
RE: STOP in 34s
Gérard, j'ai pas complètement compris ton problème. N'hésite pas de l'expliquer en Français, s.t.p.

Marcus von Cube
Wehrheim, Germany
http://www.mvcsys.de
http://wp34s.sf.net
http://mvcsys.de/doc/basic-compare.html
Find all posts by this user
Quote this message in a reply
12-01-2015, 07:36 PM
Post: #3
RE: STOP in 34s
(11-30-2015 10:38 AM)ggauny@live.fr Wrote:  While I was playing with Stop instruction (R/S), I was despite by this :
(...)
Really I don't understand !

Neither do I. ;-)

Gérard, please post the complete code and give an example for what you do not understand.

Dieter
Find all posts by this user
Quote this message in a reply
12-01-2015, 08:07 PM
Post: #4
RE: STOP in 34s
Hi,

It is because I search a routine that give me the primes factors divisors of an integer, so if my test is false I ask the routine return at LBL'x', in others words :
if the test is true : pause, if false go up to the first line to redo the search, but not go to the first line of program.

This is what I don't understand, because to know what is primes divisors of an integer I divide by 2, after i divise by 2 one again, if not divisible I up to line one and I try with 3, and so on.

As an example : 28 is 2^2, 7, but me I have not this in routine because no go to line one.

It is difficult because I don't understand your english and you don't understand mine.

A friend said to me that if I am stranggled I speak french, but in french nobody is going to understand, in english too it seems !

Don't care of this because it is no important, I will find.

Gérard.
Find all posts by this user
Quote this message in a reply
12-01-2015, 08:29 PM
Post: #5
RE: STOP in 34s
Bonsoir Gérard,

we have a few people on this forum speaking French. So there is a good chance you will find somebody who comprehends your perfect Francais. I guess the probability is greater than finding somebody comprehending French English.

Cordialment,

d:-)
Find all posts by this user
Quote this message in a reply
12-01-2015, 08:58 PM
Post: #6
RE: STOP in 34s
(12-01-2015 08:07 PM)ggauny@live.fr Wrote:  It is because I search a routine that give me the primes factors divisors of an integer, so if my test is false I ask the routine return at LBL'x', in others words :
if the test is true : pause, if false go up to the first line to redo the search, but not go to the first line of program.

This is what I don't understand, because to know what is primes divisors of an integer I divide by 2, after i divise by 2 one again, if not divisible I up to line one and I try with 3, and so on.

This is not a problem concerning the R/S key or the STOP command, it's simply a question of the algorithm. Here is a VERY simple, in no way optimized version of such an algorithm. But is will work. ;-)

Code:
input n
divisor = 2

:start   <---------------+
                         ^
if n mod divisor = 0     |
   print divisor         |
   n = n / divisor       |
   goto start   ---------+
                         ^
divisor = divisor + 1    |
if divisor <= sqrt(n)    |
   goto start  ----------+

print n

Now try to write a 34s program that implements this method.

If if works you can add the first improvement: after the first divisor has been incremented from 2 to 3, increment all following divisors by two so that you get 2 3 5 7 9...

(12-01-2015 08:07 PM)ggauny@live.fr Wrote:  It is difficult because I don't understand your english and you don't understand mine.

I am not sure if you would understand my French – it is really bad. #-)
But I think I would understand the one or other French sentence you write. At least if it's not too complicated. ;-)

Dieter
Find all posts by this user
Quote this message in a reply
12-03-2015, 08:28 AM
Post: #7
RE: STOP in 34s
Hi Dieter,

Thank you for understand me.

Well I have the target to calcul prime factors on an integer, but notonly have first digit R/S, second digit R/S and etc. Do you saw ? Of course it is possible because 34s have alpha register and me I want to see this, more comprehensible to see :

ex : 262164---> 2^18 than wait 18 times with R/S

ex : 9.670.248--->2^3 3^2 7^2 2741

is more readabily than to have to press n times R/S and see 2 2 2 3 3 7 7 2741 . I do my routine from my own hp67 and also from WP34s'libruary with PF.

Attachement is my flowchart of hp67, but you see I add "number time" is a same divisor in register J.

Have all a nice day.

Gérard.
Find all posts by this user
Quote this message in a reply
12-03-2015, 09:05 AM
Post: #8
RE: STOP in 34s
I would precision that with the great YDON, it is possible to split as this :

YDON----->2^2 7
X display-->28.

I have not mentionned but I calcul only to square N, because after it is superflous.

Some of my tests give me good hopes, I test with my HP42s, which have 2 lignes
of display.

Hi,

Gérard.
Find all posts by this user
Quote this message in a reply
12-03-2015, 09:24 AM (This post was last modified: 12-03-2015 09:25 AM by Dieter.)
Post: #9
RE: STOP in 34s
(12-03-2015 08:28 AM)ggauny@live.fr Wrote:  Well I have the target to calcul prime factors on an integer, but notonly have first digit R/S, second digit R/S and etc. Do you saw ? Of course it is possible because 34s have alpha register and me I want to see this, more comprehensible to see :

ex : 262164---> 2^18 than wait 18 times with R/S

ex : 9.670.248--->2^3 3^2 7^2 2741

No problem. Just add a counter and display the factor and its exponent before the next divisor is tested.

Your flowchart includes such a counter in j. But nevertheless it will not work – I have attached a corrected version. You also have to initialize i at the start (i=1) and include an exit condition (i > √n? then quit and display n, unless it equals 1).

Dieter
   
Find all posts by this user
Quote this message in a reply
12-03-2015, 11:06 AM
Post: #10
RE: STOP in 34s
Yes, I see I have maded mistake with the flowchart electronic, on paper I was good.

If I note I = I +1, it is because in my routine I have put "back step" to. In this case I canot biguin with I = 2, It is a little detail, but I understand you.

By the ways, I think it is possible to do "ASN" in key board, I was the last night, reading the "beginer book 34s" and the writer give the solution, if I put a LBL'nnn'
to a key board, after I don't press XEQ'nnn', it is long, I press only the key by XEQ'the key', and I have made a overlay with paper, like in HP41, with my programs write under key. It run pretty well.

Gérard.
Find all posts by this user
Quote this message in a reply
12-03-2015, 11:24 AM
Post: #11
RE: STOP in 34s
I don't remember why the FACTOR command was pulled out of the 34S.

Space or too slow would be the obvious choices, but it was a long while ago.

- Pauli
Find all posts by this user
Quote this message in a reply
12-03-2015, 11:56 AM
Post: #12
RE: STOP in 34s
Dear Sir,

IMHO, I think it is because WP34s is optimized with low environnement, but it is no a problem because we have to write what miss us, as said HP "If you miss a command, creat it". Because you conceptized, what about you are thinking for a possible way to "ASN" with WP34s, in I it is pretty working, you know ?

Now, in replacing for ex XEQ'xxx', that it is type 5 key, I only type XEQ and one key, it is economising 3 type, and with overlay in paper I know all my name programs.

Only recommandation, don't cut it off the real lbl, because you lost it, do as this :
fLBL'NNN'
LBL (here the key you want, if it is for sample EEX, you type EEX that it is LBL34)

With the paper overlay, you recognize what program you want, and it is pretty runing. Like in 41 or 42 ASN.

I thank the autor for me gived this trick !

Gérard.
Find all posts by this user
Quote this message in a reply
12-03-2015, 12:06 PM
Post: #13
RE: STOP in 34s
I have omitted to write this : FWIW, I seen this in some message, it is "if it is of some utility", I think.

Gérard.
Find all posts by this user
Quote this message in a reply
12-03-2015, 12:11 PM
Post: #14
RE: STOP in 34s
Bonjour Gérard, voyez pp. 115-118 dans votre manuel, svp.

d:-)
Find all posts by this user
Quote this message in a reply
12-03-2015, 12:25 PM
Post: #15
RE: STOP in 34s
See this,

If for example I know only this : 1914, 169 what it is the date of burn of my Mother, I can do this :

1914 ENTER
169 XEQ'DYD',(5 press) what it is Date of Year Day

But now I only do :

1914 ENTER
169 XEq EEX (Only 2 press), ( Did you noticed only ONE key )

And give me 18,061914, (it was a tursday)
And it is the date of borning of my Mother.

I insist because I am afraid to be not clear.

Gérard.
Find all posts by this user
Quote this message in a reply
12-03-2015, 03:40 PM (This post was last modified: 12-03-2015 03:44 PM by Dieter.)
Post: #16
RE: STOP in 34s
(12-03-2015 12:25 PM)ggauny@live.fr Wrote:  But now I only do :

1914 ENTER
169 XEq EEX (Only 2 press), ( Did you noticed only ONE key )

This is a feature of the 34s – which of course in completely unrelated to the prime factor algorithm we are discussing here. XEQ EEX is a shortcut for XEQ 34, as this is the keycode of the EEX key.

On the other hand global labels like LBL"DYD" can be called from anywhere, while local labels like LBL 34 are only valid within until the next END appears.

But all this is nothing new. Do you have a HP41 at hand? Press [XEQ] [SIN] or [RCL] [LOG] and see what you get (hold down the second key). ;-) Actually I never press something like [STO] [0] [5] on my '41, I always use [STO] [LN] instead.

Dieter
Find all posts by this user
Quote this message in a reply
12-03-2015, 06:36 PM
Post: #17
RE: STOP in 34s
Yes, I was thinking it was like ASN, but I am wronged. Apolosize, I have understand with the sample HP 41 because I have and I done.

Then, unfortunately, it is no way to ASS, I regret because assignation was very comfortabely.

Thank for me open eyes on this

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




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