(HP17BII) What way for a loop stop condition ?
|
05-09-2020, 01:06 PM
Post: #1
|
|||
|
|||
(HP17BII) What way for a loop stop condition ?
(HP17BII) What way for a loop stop condition ?
You know the Czech guess, of course (conjecture tchèque in French) ? In fact, i have a question ! Just be a little patient... A natural equation for the resolution of this sequence on the HP17BII would be as follows : Code:
with this use process : [CALC] gives [SUITE] [N] 3 [N] --> N=3 [SUITE] --> SUITE=10 [SUITE] --> SUITE=5 [SUITE] --> SUITE=16 [SUITE] --> SUITE=8 [SUITE] --> SUITE=4 [SUITE] --> SUITE=2 [SUITE] --> SUITE=1 So, 3 requires 7 steps to become 1 But, if you want an easy way to follow the number of sequences from the initial N until 1, you could modify the equation as well : Code:
with a very similar use process : [CALC] gives [SUITE] [N] [NB] DSP [FIX] 4 INPUT 3 [N] --> N=3.0000 [SUITE] --> SUITE=10.0001 [SUITE] --> SUITE=5.0002 [SUITE] --> SUITE=16.0003 [SUITE] --> SUITE=8.0004 [SUITE] --> SUITE=4.0005 [SUITE] --> SUITE=2.0006 [SUITE] --> SUITE=1.0007 and the same number of steps to move 3 to 1 This time, there is a satisfying equation... for a little sequence and if you have a good memory to remember the initial N !! So, a step further, i propose you to evolve this equation by modifying it again. Then, i use a internal variable to conserve the initial N and i do the insertion of a loop control to computerize the sequence from N to 1. This is the equation : Code:
and the use process evolves as follow : [CALC] gives [CT] [N] [MAX] DSP [ALL] 10 [MAX] 3 [N] [CT] --> CT=7 Now, you receive the number of sequence as a result of the equation with [CT]. That's OK. What is more disputable is that : - we need to know beforehand the maximum number of iterations to perform, before launching the evaluation of the equation - if we have incorrectly evaluated the maximum number of iterations necessary, we will not know it - if we choose for security a very large forecast number of iterations, the calculator will perform a very long processing without this being necessary - to be fair, the maximum should be adjusted for each evaluation of the number of sequences with each number: compare CT(3)=7 with CT(837799)=524... So, a new alternative to modifying the equation could be this : Code:
With the control of the variable [W], by RCL [W] at the end of the calculation, you should verify if the last term of the sequence is effectively 1. You should initialize MAX to 1000 (1000 [MAX]) before enter N (3 [N] or 837799 [N]) and evaluate the equation by [CT]. However, the resolution time will always be the same with a fairly long time. So, it's time for me to ask my question !! Has anyone ever solved checking the end of the loop condition dynamically on the HP17BII or HP27S ? Or on the more recent HP17BII+ ? Is there possible to have a end condition based on the evaluation of the last term of the sequence ? Have you an other proposition to rewrite this equation in order to allow the dynamic resolution of this ? (Is this possible stopping to loop as soon as the last term is 1 ?) |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(HP17BII) What way for a loop stop condition ? - Nihotte(lma) - 05-09-2020 01:06 PM
RE: (HP17BII) What way for a loop stop condition ? - Don Shepherd - 05-09-2020, 02:27 PM
RE: (HP17BII) What way for a loop stop condition ? - Nihotte(lma) - 05-09-2020, 05:43 PM
RE: (HP17BII) What way for a loop stop condition ? - Nihotte(lma) - 05-09-2020, 08:09 PM
RE: (HP17BII) What way for a loop stop condition ? - mfleming - 05-09-2020, 02:36 PM
|
User(s) browsing this thread: 1 Guest(s)