OFFSET
1,4
COMMENTS
Inspired by a test ARML problem from 2018, which asked students to determine a(8).
LINKS
Rémy Sigrist, PARI program for A304935
EXAMPLE
a(2) = a(3) = 0, since no positive squares are achievable.
Some examples:
a(7) = 71 = sqrt(0+1+2*3*4*5*6*7).
a(8) = 19 = sqrt(0+1*2+3+4*5+6*7*8).
a(20) = 246960 = sqrt(0+1*2*3*4*5*6*7*8*9*10*11+12*13*14*15*16*17*18*19*20)
MATHEMATICA
sqStrTest[n_] := Module[{bVal, bStr, i, j, iB, mVal, mStr},
bVal = -1;
For[i = 0, i < 2^n, i++,
iB = IntegerDigits[i, 2];
While[Length[iB] < n, PrependTo[iB, 0]];
mStr = "0";
For[j = 1, j <= n, j++,
mStr = StringJoin[mStr, If[iB[[j]] == 0, "+", "*"], ToString[j]]];
mVal = ToExpression[mStr];
If[Sqrt[mVal] == Floor[Sqrt[mVal]],
If[mVal > bVal, {bVal, bStr} = {mVal, mStr}]
]
];
Print[{Sqrt[bVal], bVal, bStr}]]
PROG
(PARI) See Links section.
CROSSREFS
KEYWORD
nonn
AUTHOR
Andy Niedermaier, May 21 2018
EXTENSIONS
More terms from Rémy Sigrist, May 22 2018
STATUS
approved