解説

  1. 1k1,k2,.....kntm1\leq k1,k2,.....kn\leq t \leq mを満たす(k1,k2,......kn,t)(k1,k2,......kn,t)の組み合わせは
  • ttを固定にして考えると k=1mkn\displaystyle\sum_{k=1}^{m}k^n

  • k1,k2,...knk1,k2,...knを固定して考えると k1=1mk2=1m...kn=1m(m+1max(k1,..kn))\displaystyle\sum_{k1=1}^{m}\sum_{k2=1}^{m}...\sum_{kn=1}^{m}(m+1-max(k1,..kn))

    よって k=1mkn=k1=1mk2=1m...kn=1m(m+1max(k1,..kn))\displaystyle\sum_{k=1}^{m}k^n=\displaystyle\sum_{k1=1}^{m}\sum_{k2=1}^{m}...\sum_{kn=1}^{m}(m+1-max(k1,..kn)) から k1=1mk2=1m...kn=1mmax(k1,..kn)=(m+1)mnk=1mkn\displaystyle\sum_{k1=1}^{m}\sum_{k2=1}^{m}...\sum_{kn=1}^{m}{max(k1,..kn)}=(m+1)m^n-\sum_{k=1}^{m}k^n

  1. mk1,k2,.....knt1m\geq k1,k2,.....kn\geq t\geq 1を満たす (k1,k2,......kn,t)(k1,k2,......kn,t)の組み合わせは
  • ttを固定にすると k=1m(mk+1)n=k=1mkn\displaystyle\sum_{k=1}^{m}(m-k+1)^n=\sum_{k=1}^{m}k^n

  • k1,k2,...knk1,k2,...knを固定すると k1=1mk2=1m...kn=1mmin(k1,..kn)\displaystyle\sum_{k1=1}^{m}\sum_{k2=1}^{m}...\sum_{kn=1}^{m}min(k1,..kn)

    よって k1=1mk2=1m...kn=1mmin(k1,..kn)=k=1mkn\displaystyle\sum_{k1=1}^{m}\sum_{k2=1}^{m}...\sum_{kn=1}^{m}min(k1,..kn)=\sum_{k=1}^{m}k^n

k1=1mk2=1m...kn=1mmax(k1,..kn)+min(k1,..kn)=(m+1)mn\displaystyle\sum_{k1=1}^{m}\sum_{k2=1}^{m}...\sum_{kn=1}^{m}max(k1,..kn)+min(k1,..kn)=(m+1)m^n

実装例 (Python)