cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A008782 For any circular arrangement of 0..n-1, let S = sum of squares of every sum of three contiguous numbers; then a(n) = # of distinct values of S.

This page as a plain text file.
%I A008782 #21 Oct 30 2022 18:19:59
%S A008782 1,1,1,1,8,17,55,110,184,272,384,522,681,874,1101,1354
%N A008782 For any circular arrangement of 0..n-1, let S = sum of squares of every sum of three contiguous numbers; then a(n) = # of distinct values of S.
%p A008782 A008782 := proc(n) local S,i,j,sumsq,npermut,p,per ; S := {} ; npermut := combinat[permute]([seq(i,i=0..n-1)]) ; for p from 1 to nops(npermut) do per := op(p,npermut) ; sumsq := 0 ; for i from 0 to n-1 do sumsq := sumsq + (add(op(1+(j mod n),per),j=i..i+2)) ^2 ; od ; S := S union {sumsq} ; od ; RETURN(nops(S)) ; end: for n from 1 to 20 do print(A008782(n)) ; od : # _R. J. Mathar_, Jun 18 2007
%t A008782 a[n_] := Module[{S, i, j, Sumsq, npermut, p, per}, S = {}; npermut = Permutations[Range[0, n-1]]; For[p = 1, p <= Length[npermut], p++, per = npermut[[p]]; Sumsq = 0; For[i = 0, i <= n-1, i++, Sumsq = Sumsq + Sum[per[[1+Mod[j, n] ]], {j, i, i+2}]^2]; S = S ~Union~ {Sumsq}]; Return[Length[S]]]; Table[Print[an = a[n]]; an, {n, 1, 10}] (* _Jean-François Alcover_, Jan 13 2014, translated from _R. J. Mathar_'s Maple code *)
%Y A008782 Cf. A007773.
%K A008782 nonn,more
%O A008782 1,5
%A A008782 _Olivier Gérard_
%E A008782 More terms from _Reiner Martin_, May 19 2001
%E A008782 a(11)-a(13) from _Sean A. Irvine_, May 05 2010
%E A008782 a(14)-a(16) from _Donovan Johnson_, Nov 30 2010