Post Reply 
[VA] SRC #017 - April 1st, 2024 Spring Special
04-15-2024, 08:17 PM (This post was last modified: 04-15-2024 08:48 PM by Gerson W. Barbosa.)
Post: #15
RE: [VA] SRC #017 - April 1st, 2024 Spring Special
(04-10-2024 08:51 PM)Valentin Albillo Wrote:  Additional comments:  No one posted all four squares so three of them were left missing (though once you've created your multiprecision squaring program it's all too easy to use it to compute the squares and post them) and no one posted any more examples of this pattern so here you are, a few more:

      774700591300020347197007492 =

            6001610061606011616611060006010661000616100111161001

      9425754295779433269877982 =

            888448440444044400080440444440408800048040888804

Here's a less sloppy HP-75 program with all four squares plus one found at OEIS. When I was editing it, I noticed there was a typo in line 115 of my previous program, current line 125: the second 2 should be 1. The numbers to be squared are placed in DATA lines, divided in chunks of six digits with no leading zeros, preceded by the number of chunks.

10 OPTION BASE 0
15 INTEGER I,J,K,L,N
25 B=1000000
30 DIM A(9),B(5),C(12)
35 REM DIM A(N+4), B(N), C(2*N+2); N>1
40 FOR K=1 TO 5
45 READ N
50 FOR I=0 TO 2*N+2 @ C(I)=0 @ NEXT I
55 FOR I=0 TO N+4 @ A(I)=0 @ NEXT I
60 FOR I=1 TO N
65 READ A(I)
70 B(I)=A(I)
75 NEXT I
80 FOR I=N TO 1 STEP -1
85 T1=0 @ A1=0
90 FOR J=N-I+4 TO -1 STEP -1
95 C2=(T1+B(I)*A(J+1))/B
100 A1=FP(C2)*B
105 C(I+J)=C(I+J)+A1
110 T1=IP(C2)
115 NEXT J
120 NEXT I
125 FOR I=2*N TO 1 STEP -1
130 T=C(I)/B
135 C(I)=FP(T)*B
140 C(I-1)=C(I-1)+IP(T)
145 NEXT I
150 L=1
155 IF C(0)<>0 THEN DISP STR$(C(0));ELSE DISP STR$(C(1)); @ L=2
160 FOR I=L TO 2*N-1
165 C$=STR$(C(I)) @ C$=RIGHT$(C$,LEN(C$))
170 IF 6-LEN(C$)=0 THEN GOTO 185
175 C$="0"&C$
180 GOTO 170
185 DISP C$;
190 NEXT I
195 DISP
200 NEXT K
205 END
210 DATA 3,130834,904430,15239
215 DATA 4,471287,714788,971663,493899
220 DATA 5,25,781108,305591,628417,975738
225 DATA 5,141422,82876,67219,949805,50005
230 DATA 5,100,990098,979999,970099,500001

>RUN
17117772217211221211117217772227121
222112110111011100020110111110102200012010222201
664665545464645645665646644665564654546645556644644
20000205525005225202000505202222520222202205205000550500025
10199000091990191001091091099001091999900190199000001


Edited to remove an unnecessary BASIC line
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 - Gerson W. Barbosa - 04-15-2024 08:17 PM



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