login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A085047 a(n) is the least number not already used such that the arithmetic mean of the first n terms is a square. 3
1, 7, 4, 24, 9, 51, 16, 88, 25, 135, 36, 192, 49, 259, 64, 336, 81, 423, 100, 520, 121, 627, 144, 744, 169, 871, 196, 1008, 225, 1155, 256, 1312, 289, 1479, 324, 1656, 361, 1843, 400, 2040, 441, 2247, 484, 2464, 529, 2691, 576, 2928, 625, 3175, 676, 3432, 729 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

This is very nearly a linear recurrence, but the distinctness requirement occasionally foils it. - Charles R Greathouse IV, Nov 07 2014

LINKS

Alois P. Heinz, Table of n, a(n) for n = 1..10000

FORMULA

a(2*n-1) = n^2; a(2*n) = n*(2+5*n). Also, (1/(2*n))*(Sum_{i=1..n} i^2 + i*(2+5*i)) = (n+1)^2 and (1/(2*n-1))*(Sum_{i=1..n} i^2 + (i-1)*(5*i-3)) = k^2. Thus the arithmetic mean of the first 2*n terms is (n+1)^2 and the arithmetic mean of the first 2*n-1 terms is n^2. - Derek Orr, Jun 26 2015

EXAMPLE

(a(1) + a(2) + a(3) + a(4) + a(5))/5 = (1+7+4+24+9)/5 = 9 = 3^2.

MAPLE

b:= proc(n) is(n>1) end:

s:= proc(n) option remember;

      `if`(n=1, 1, s(n-1)+a(n))

    end:

a:= proc(n) option remember; local k;

      if n=1 then 1

    else for k from n-irem(s(n-1), n) by n

         do if b(k) and issqr((s(n-1)+k)/n)

               then b(k):=false; return k

            fi

         od

      fi

    end:

seq(a(n), n=1..150);  # Alois P. Heinz, Nov 07 2014

MATHEMATICA

Clear[a, b, s]; b[n_] := n>1; s[n_] := s[n] = If[n == 1, 1, s[n-1] + a[n]]; a[n_] := a[n] = Module[{k}, If [n == 1, 1, For[k = n - Mod[s[n-1], n], True, k = k+n, If[b[k] && IntegerQ[Sqrt[(s[n-1]+k)/n]], b[k] = False; Return[k]]]]]; Table[a[n], {n, 1, 150}] (* Jean-Fran├žois Alcover, Jun 10 2015, after Alois P. Heinz *)

PROG

(PARI) v=[1]; n=1; while(#v<50, s=(n+vecsum(v))/(#v+1); if(type(s)=="t_INT", if(issquare(s)&&!vecsearch(vecsort(v), n), v=concat(v, n); n=0)); n++); v \\ Derek Orr, Nov 05 2014, edited Jun 26 2015

CROSSREFS

Cf. A168668.

Sequence in context: A147601 A075536 A280336 * A213831 A282361 A213564

Adjacent sequences:  A085044 A085045 A085046 * A085048 A085049 A085050

KEYWORD

nonn

AUTHOR

Amarnath Murthy, Jun 20 2003

EXTENSIONS

More terms from David Wasserman, Jan 11 2005

Incorrect formulas and programs removed by Charles R Greathouse IV, Nov 07 2014

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 3 05:55 EDT 2020. Contains 336197 sequences. (Running on oeis4.)