Post Reply 
[VA] SRC #017 - April 1st, 2024 Spring Special
04-03-2024, 06:13 PM (This post was last modified: 04-04-2024 07:04 PM by C.Ret.)
Post: #5
RE: [VA] SRC #017 - April 1st, 2024 Spring Special
(04-02-2024 08:29 AM)J-F Garnier Wrote:  
(04-01-2024 06:59 PM)Valentin Albillo Wrote:        As we have that  GCD(15, 4) = 1  and  GCD(15, 5) = 5,  for what value of x is  GCD(15, x) = 2 ?

OK, let's try to solve GCD(15,X)=2 for X on the 71B w/ Math ROM.
Since GCD only accepts integer values, I had to cast the X variable to the INT type.
Choosing 0 and 10 as the initial guesses:

>FNROOT(0,10,GCD(15,INT(FVAR))-2)
12.9999999999

We can safely round the result to X=13.
An interesting result, isn't it?

This is a surprising result!

I believe that looking for x such that GCD(15,x)= 2 is like looking for a hairy fish (a very common fish at the very beginning of the April River).

Here is my code for any HP-71B to find x: 10 DISP “GCD( 15 , NaN ) = 2” and what it display:                  GCD( 15 , NaN ) = 2 
[Image: attachment.php?aid=13424]
   


But, I may have start by the first apriL foOL :

Here is my program to compute a large square on the HP-71B:

10 DESTROY ALL @ DIM A$[39] @ INPUT A$ @ L=LEN(A$) @ DIM R$[2*L] @ R$=SPACE$(48,2*L)
20 FOR K=L TO 1 STEP -1 @ C=0 @ FOR J=L TO 1 STEP -1 @ I=K+J
30 X=C+VAL(R$[I,I])+VAL(A$[J,J])*VAL(A$[K,K]) @ R$[I,I]=CHR$(48+MOD(X,10)) @ C=X DIV 10
40 NEXT J @ R$[K,K]=CHR$(48+C) @ DISP R$[K+L] @ NEXT K @ DISP R$ @ BEEP @ PAUSE


The calculation takes longer as the number is larger.
One can follow the progress of the computation as the figures are displayed as soon as they are determined. That is to say starting from the last towards the first.

[RUN]
? _
? 141422082876067219949805050005_ [END LINE]
                              (prgm)
> 5                            (prgm)
> 25                           (prgm)
> 025                           (prgm)
> 0025                          (prgm)
> 00025                          (prgm)
> 500025                         (prgm)
. . .
> 2520222202205205000550500025           (prgm)
> 22520222202205205000550500025          (prgm)
~ biiiip ~
> 020000205525005225202000505202222520222202205205000550500025     (susp)


You will note the presence of a leading zero which is important but which is not systematic. Try to calculate 99999999².

A small figure which shows how the calculation is done:[Image: attachment.php?aid=13426]
   

several edit to correct broken English, code syntax, insert illustrations and correct typos
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] SRC #017 - April 1st, 2024 Spring Special - C.Ret - 04-03-2024 06:13 PM



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