OFFSET
1,5
MAPLE
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
MATHEMATICA
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 *)
CROSSREFS
KEYWORD
nonn,more
AUTHOR
EXTENSIONS
More terms from Reiner Martin, May 19 2001
a(11)-a(13) from Sean A. Irvine, May 05 2010
a(14)-a(16) from Donovan Johnson, Nov 30 2010
STATUS
approved