login
A304935
a(n) is the largest possible integer value for sqrt(0 _ 1 _ 2 _ ... _ n), where one is allowed to place any mixture of +'s and *'s in the n blank spaces.
1
1, 0, 0, 5, 11, 6, 71, 19, 123, 33, 174, 426, 174, 233, 625, 816, 5695, 3656, 15936, 246960, 24234, 24234, 35151, 140604, 177399, 250982, 1304130, 1304130, 1304130, 1304130, 5532955, 5532955, 58136459, 8525544, 8525544, 58136459, 941988492, 58136459, 941988492
OFFSET
1,4
COMMENTS
Inspired by a test ARML problem from 2018, which asked students to determine a(8).
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
Upper-bounded by sqrt(A038507).
Sequence in context: A274266 A365726 A318259 * A156274 A079778 A172183
KEYWORD
nonn
AUTHOR
Andy Niedermaier, May 21 2018
EXTENSIONS
More terms from Rémy Sigrist, May 22 2018
STATUS
approved