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.

A339454 Number of subsets of {1..n} whose root mean square is an integer.

This page as a plain text file.
%I A339454 #17 Mar 25 2025 12:18:05
%S A339454 1,2,3,4,5,6,9,10,15,20,29,52,87,166,311,538,943,1682,2915,5054,8905,
%T A339454 15904,28533,51826,95191,175402,325777,607542,1134191,2128922,3986433,
%U A339454 7485522,14065135,26446388,49796025,93920770,177470237,335780796,636883269,1209603646
%N A339454 Number of subsets of {1..n} whose root mean square is an integer.
%H A339454 Max Alekseyev, <a href="/A339454/b339454.txt">Table of n, a(n) for n = 1..100</a>
%H A339454 Eric W. Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Root-Mean-Square.html">Root-Mean-Square</a>
%F A339454 a(n) = A357415(n) + A357416(n). - _Max Alekseyev_, Mar 25 2025
%e A339454 a(9) = 15 subsets: {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {1, 7}, {1, 5, 7}, {1, 3, 5, 8, 9}, {3, 4, 5, 7, 9}, {1, 3, 5, 6, 8, 9} and {3, 4, 5, 6, 7, 9}.
%o A339454 (Python)
%o A339454 from functools import lru_cache
%o A339454 from sympy.ntheory.primetest import is_square
%o A339454 def cond(sos, c): return c > 0 and sos%c == 0 and is_square(sos//c)
%o A339454 @lru_cache(maxsize=None)
%o A339454 def b(n, sos, c):
%o A339454     if n == 0: return int(cond(sos, c))
%o A339454     return b(n-1, sos, c) + b(n-1, sos+n*n, c+1)
%o A339454 a = lambda n: b(n, 0, 0)
%o A339454 print([a(n) for n in range(1, 41)]) # _Michael S. Branicky_, Oct 06 2022
%Y A339454 Cf. A051293, A240089, A326027, A339453.
%K A339454 nonn
%O A339454 1,2
%A A339454 _Ilya Gutkovskiy_, Dec 05 2020
%E A339454 a(23)-a(40) from _Alois P. Heinz_, Dec 05 2020