A385904 a(n) is the number of nonempty subsets of the divisors of n that sum to a perfect square.
1, 1, 2, 2, 1, 4, 1, 3, 3, 2, 1, 11, 1, 3, 4, 5, 1, 9, 1, 9, 3, 3, 1, 27, 2, 2, 4, 8, 1, 27, 1, 7, 3, 2, 2, 49, 1, 1, 3, 22, 1, 21, 1, 7, 8, 3, 1, 77, 2, 5, 2, 4, 1, 22, 2, 21, 2, 1, 1, 248, 1, 2, 7, 11, 1, 21, 1, 4, 2, 17, 1, 235, 1, 1, 9, 7, 1, 20, 1, 64, 6, 1
Offset: 1
Keywords
Examples
a(6) = 4 because exactly the 4 nonempty subsets {1}, {1, 3}, {1, 2, 6} and {3, 6} of the divisors of 6 sum to a perfect square: 1 = 1^2, 1 + 3 = 2^2, 1 + 2 + 6 = 3^2.
Links
- Felix Huber, Table of n, a(n) for n = 1..10000
Programs
-
Maple
with(NumberTheory): A385904:=proc(n) local b,l,j; l:=[(Divisors(n))[]]: b:=proc(m,i) option remember; `if`(m=0,1,`if`(i<1,0,b(m,i-1)+`if`(l[i]>m,0,b(m-l[i],i-1)))) end; add(b(j^2,nops(l)),j=1..floor(sqrt(sigma(n)))); end: seq(A385904(n),n=1..82);
-
Mathematica
a[n_]:=Module[{nb = 0, d = Divisors[n]},Length[Select[Subsets[d],IntegerQ[Sqrt[Total[#]]]&]]]-1;Array[a,82] (* James C. McMahon, Jul 27 2025 *)
-
PARI
a(n) = my(nb=0, d=divisors(n)); forsubset(#d, s, nb+=issquare(sum(i=1, #s, d[s[i]]))); nb-1; \\ Michel Marcus, Jul 22 2025
Formula
a(p) = 1 for primes p != 3.