OFFSET
0,3
COMMENTS
This question originated from generalization of the puzzle 'Low Budget' in the book Mathematical Puzzles and Curiosities.
REFERENCES
I. David, T. Khovanova, and Y. Shpilman, Mathematical Puzzles and Curiosities, World Scientific, 2026, p. 2.
LINKS
Index entries for linear recurrences with constant coefficients, signature (3,-2,-2,3,-1).
FORMULA
a(n) = (2*n^3 - 6*n^2 + 13*n - 12 + 3*(-1)^n)/3 for n>=2.
a(n) = 4*A026035(n) - 2*n^2 + 3*n - 3.
G.f.: x^2*(2*x^4-3*x^3+7*x^2-x+3)/((x+1)*(x-1)^4).
EXAMPLE
For n=4, the minimum is achieved for permutation 5,3,1,7 of the first four odd numbers. The value is 5*3+3*1+1*7=25. Thus, a(4) = 25.
MATHEMATICA
a[n_]:= (2*n^3 - 6*n^2 + 13*n - 12 + 3*(-1)^n)/3; a[0]=0; a[1]=0; Array[a, 44, 0] (* or *)
CoefficientList[Series[x^2*(2*x^4-3*x^3+7*x^2-x+3)/((x+1)*(x-1)^4) , {x, 0, 43}], x] (* James C. McMahon, Apr 25 2026 *)
PROG
(Python)
def A394241(n): return n*(n*(n-3<<1)+13)//3-(5 if n&1 else 3) if n>1 else 0 # Chai Wah Wu, Apr 24 2026
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Tanya Khovanova and PRIMES STEP junior group, Apr 19 2026
STATUS
approved
