login
Sequence of distinct least squares such that the arithmetic mean of the first n squares is also a square.
1

%I #16 Jan 26 2014 15:22:41

%S 1,49,25,121,784,196,33124,4900,4,4356,2304324,213444,2371600,379456,

%T 87616,360000,3802500,562500,100,532900,5456896,767376,5934096,992016,

%U 9947716,1350244,32467204,44100,2414916,10458756,2683044

%N Sequence of distinct least squares such that the arithmetic mean of the first n squares is also a square.

%H Giovanni Resta, <a href="/A236247/b236247.txt">Table of n, a(n) for n = 1..200</a>

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

%e a(1) = 1.

%e a(2) is the smallest unused square such that (a(2)+a(1))/2 is a square. So, a(2) = 49.

%e a(3) is the smallest unused square such that (a(3)+a(2)+a(1))/3 is a square. So, a(3) = 25.

%e ...and so on.

%o (Python)

%o def Sq(x):

%o ..for n in range(10**15):

%o ....if x == n**2:

%o ......return True

%o ....if x < n**2:

%o ......return False

%o ..return False

%o def SqAve(init):

%o ..print(init)

%o ..lst = []

%o ..lst.append(init)

%o ..n = 1

%o ..while n < 10**9:

%o ....if n**2 not in lst:

%o ......if Sq(((sum(lst)+n**2)/(len(lst)+1))):

%o ........print(n**2)

%o ........lst.append(n**2)

%o ........n = 1

%o ......else:

%o ........n += 1

%o ....else:

%o ......n += 1

%o SqAve(1)

%Y Cf. A019444, A141391.

%K nonn

%O 1,2

%A _Derek Orr_, Jan 20 2014