[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 ? 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 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: several edit to correct broken English, code syntax, insert illustrations and correct typos |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 12 Guest(s)