login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

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

%I #47 May 02 2017 22:17:18

%S 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,

%T 25,28,33,32,35,34,33,35,38,38,40,36,42,42,42,41,48,48,47,51,50,50,49,

%U 52,49,57,57,59,59,58,58,63,63,63,62,61,66,66,67,64,73,73

%N 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.

%C Sum analog of R. L. Graham's sequence (A006255).

%H Peter Kagey, <a href="/A277278/b277278.txt">Table of n, a(n) for n = 0..3000</a>

%F a(n^2) = n^2.

%e a(0) = 0 via 0 = 0^2

%e a(1) = 1 via 1 = 1^2

%e a(2) = 4 via 2 + 3 + 4 = 3^2

%e a(3) = 6 via 3 + 6 = 3^2

%e a(4) = 4 via 4 = 2^2

%e a(5) = 10 via 5 + 6 + 7 + 8 + 10 = 6^2

%e a(6) = 10 via 6 + 10 = 4^2

%o (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

%o (Haskell)

%o import Data.List (find)

%o import Data.Maybe (fromJust)

%o isSquare m = m == (integerRoot * integerRoot) where

%o integerRoot = floor (sqrt (fromIntegral m)::Double)

%o a277278 n

%o | isSquare n = n

%o | otherwise = last $ fromJust $ find (isSquare . sum) s where

%o s = map ((n:) . map (n+)) a048793_tabf

%o -- _Peter Kagey_, Oct 19 2016

%Y Cf. A006255.

%K nonn

%O 0,3

%A _Peter Kagey_, Oct 15 2016