login
A277278
a(n) = smallest m for which there is a sequence n = b_1 < b_2 < ... < b_t = m such that b_1 + b_2 +...+ b_t is a perfect square.
6
0, 1, 4, 6, 4, 10, 10, 9, 14, 9, 14, 13, 13, 18, 18, 18, 16, 19, 22, 23, 23, 27, 27, 26, 25, 25, 28, 33, 32, 35, 34, 33, 35, 38, 38, 40, 36, 42, 42, 42, 41, 48, 48, 47, 51, 50, 50, 49, 52, 49, 57, 57, 59, 59, 58, 58, 63, 63, 63, 62, 61, 66, 66, 67, 64, 73, 73
OFFSET
0,3
COMMENTS
Sum analog of R. L. Graham's sequence (A006255).
FORMULA
a(n^2) = n^2.
EXAMPLE
a(0) = 0 via 0 = 0^2
a(1) = 1 via 1 = 1^2
a(2) = 4 via 2 + 3 + 4 = 3^2
a(3) = 6 via 3 + 6 = 3^2
a(4) = 4 via 4 = 2^2
a(5) = 10 via 5 + 6 + 7 + 8 + 10 = 6^2
a(6) = 10 via 6 + 10 = 4^2
PROG
(PARI) a(n)=if (issquare(n), return (n)); ok = 0; d = 1; while (!ok, for (j=1, 2^d-1, b = Vecrev(binary(j)); if (issquare(n+sum(k=1, #b, b[k]*(n+k))), ok = 1; break); ); if (! ok, d++); ); n+d; \\ Michel Marcus, Oct 16 2016
(Haskell)
import Data.List (find)
import Data.Maybe (fromJust)
isSquare m = m == (integerRoot * integerRoot) where
integerRoot = floor (sqrt (fromIntegral m)::Double)
a277278 n
| isSquare n = n
| otherwise = last $ fromJust $ find (isSquare . sum) s where
s = map ((n:) . map (n+)) a048793_tabf
-- Peter Kagey, Oct 19 2016
CROSSREFS
Cf. A006255.
Sequence in context: A143545 A338155 A328045 * A328722 A143521 A278363
KEYWORD
nonn
AUTHOR
Peter Kagey, Oct 15 2016
STATUS
approved