Consider the columns to be labeled N, N2 and DS, then N is the first occurrence for which the digital sum DS of N2 is also a square.
I could not find this on Sloane due to an error. Neil Sloane offered me the listing A061912. The next row is: 16667 277788889 64.
It is apparent from that response that one probably cannot analytically decide the next row of the sequence without computer intervention.
The following program does not isolate the first occurrence of a specific digit sum. Rather the program was written to create a list to hopefully determine if a pattern could be discerned.
The upper value of "a" would need to be increased, and, as this is written with Quickbasic, the N value would need to be processed outside of the program as the N2 values very quickly are truncated to scientific notation.
DIM SHARED num(30)
DIM SHARED a(20)
CLS
OPEN "sqandsq.txt" FOR OUTPUT AS #1
FOR a = 1 TO 10000
n$ = ""
n$ = LTRIM$(STR$(a * a))
ds = 0
FOR x = 1 TO LEN(n$)
a(x) = VAL(MID$(n$, x, 1))
ds = ds + a(x)
IF (SQR(ds) = INT(SQR(ds)) AND x = LEN(n$)) THEN
PRINT #1, a, n$, ds
PRINT a, n$, ds
END IF
NEXT
NEXT
CLOSE 1
|