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.

A164283 Number of ways to write n as the root-mean-square (RMS) of a set of distinct positive integers.

This page as a plain text file.
%I A164283 #13 Feb 16 2025 08:33:11
%S A164283 1,1,1,1,3,9,19,79,225,693,1901,5597,17641,57503,195431,647139,
%T A164283 2182987,7344451,25057681,85742999,295284367,1028155825,3596134963,
%U A164283 12659796475,44696280143,158226554179,562623263251,2006471222195,7182910999719,25795458946677,92875047372825,335362896810137
%N A164283 Number of ways to write n as the root-mean-square (RMS) of a set of distinct positive integers.
%H A164283 Eric Weisstein's World of Math, <a href="https://mathworld.wolfram.com/Root-Mean-Square.html">Root-Mean-Square</a>
%e A164283 a(6) = 9, because 6 is the RMS of 9 sets of distinct positive integers: 6 = RMS(6) = RMS(1,3,5,8,9) = RMS(3,4,5,7,9) = RMS(1,2,4,5,7,11) = RMS(1,3,5,6,8,9) = RMS(3,4,5,6,7,9) = RMS(1,2,3,5,7,8,10) = RMS(1,2,4,5,6,7,11) = RMS(1,2,3,5,6,7,8,10).
%p A164283 sns:= proc(i) option remember; `if`(i=1, 1, sns(i-1) +i^2) end: b:= proc(n, i, t) if n<0 or i<t then 0 elif n=0 then `if`(t=0, 1, 0) elif i=1 then `if`(n=1 and t=1, 1, 0) else b(n, i, t):= b(n, i-1, t) +b(n-i^2, i-1, t-1) fi end: a:= proc(n) option remember; local s, k; s:= 1; for k from 2 while sns(k)<=k*n^2 do s:= s +b(k*n^2, floor(sqrt(k*n^2 -sns(k-1))), k) od; s end: seq(a(n), n=1..15);
%t A164283 sns[i_] := sns[i] = If[i == 1, 1, sns[i-1] + i^2] ; b[n_, i_, t_] := Which[n < 0 || i < t, 0, n == 0, If[t == 0, 1, 0], i == 1, If[n == 1 && t == 1, 1, 0], True, b[n, i, t] = b[n, i-1, t] + b[n - i^2, i-1, t-1]]; a[n_] := a[n] = Module[{s = 1, k}, For[k = 2, sns[k] <= k*n^2, k++, s = s + b[k*n^2, Floor[Sqrt[k*n^2 - sns[k-1]]], k]]; s]; Table[Print[an = a[n]]; an, {n, 1, 29}] (* _Jean-François Alcover_, Dec 30 2013, translated from Maple *)
%o A164283 (Haskell)
%o A164283 a164283 n = f [1..] 1 nn 0 where
%o A164283    f (k:ks) l nl xx
%o A164283      | yy > nl  = 0
%o A164283      | yy < nl  = f ks (l + 1) (nl + nn) yy + f ks l nl xx
%o A164283      | otherwise = if w == n then 1 else 0
%o A164283      where w = if r == 0 then a000196 m else 0
%o A164283            (m, r) = divMod yy l
%o A164283            yy = xx + k * k
%o A164283    nn = n ^ 2
%o A164283 -- _Reinhard Zumkeller_, Feb 13 2013
%Y A164283 Cf. A163974, A066572, A066571, A072701.
%Y A164283 Cf. A000196, A211868.
%K A164283 nonn
%O A164283 1,5
%A A164283 _Alois P. Heinz_, Aug 12 2009