login
Write n as a product of primes p_{s_1}*p_{s_2}*p_{s_3}*... where p_i denotes the i-th prime; then a(n) = s_1^2 + s_2^2 + s_3^2 + ...
16

%I #24 Aug 05 2017 19:05:14

%S 0,1,4,2,9,5,16,3,8,10,25,6,36,17,13,4,49,9,64,11,20,26,81,7,18,37,12,

%T 18,100,14,121,5,29,50,25,10,144,65,40,12,169,21,196,27,17,82,225,8,

%U 32,19,53,38,256,13,34,19,68,101,289,15,324,122,24,6

%N Write n as a product of primes p_{s_1}*p_{s_2}*p_{s_3}*... where p_i denotes the i-th prime; then a(n) = s_1^2 + s_2^2 + s_3^2 + ...

%C When gcd_j(s_j) = 1, a(n) is the modulus of the determinant whose first row consists of the s_j, and whose remaining rows form a lattice basis for the space of integer solutions of Sum_j s_jx_j = 0. See A289507.

%C Compare A056239, where the same encoding for integer multisets ('Heinz encoding') is used, but where A056239(n) is the sum, rather than the sum of squares, of the elements of the corresponding multiset (partition).

%C See also A003963, for which A003963(n) is the product of the elements of the corresponding multiset.

%C See also A289507, where terms are (Sum_j s_j^2)/gcd_j(s_j) rather than Sum_j s_j^2 (this sequence).

%H Alois P. Heinz, <a href="/A289506/b289506.txt">Table of n, a(n) for n = 1..20000</a>

%F For n = Product_k p_k^{r_k}, a(n) = Sum_k k^2 * r_k.

%F Also a(n) = Sum_j s_j^2, where the multiset of s_j's is the multiset of k's, each with multiplicity r_k.

%e For n = 12 = 2^2 * 3 = p_1 * p_1 * p_2, the multiset is {1,1,2} and so a(12) = 1^2 + 1^2 + 2^2 = 6.

%e Also a(1) = 0 as n = 1 indexes the empty multiset.

%e Further a(p_k) = k^2 and a(2^r) = r.

%p p:=1:for ind to 1000 do p:=nextprime(p);primeindex[p]:=ind;od: # so primeindex[p]:=k if p is the k-th prime

%p out:=[0]:for n from 2 to 100 do f:=ifactors(n)[2];

%p m:=[];for k to nops(f) do pow:=f[k];ind:=primeindex[pow[1]];for e to pow[2] do

%p m:=[op(m),ind];od;od;out:=[op(out),sum(m[jj]^2,jj=1..nops(m))];

%p od:print(out);

%p # second Maple program:

%p a:= n-> add(numtheory[pi](i[1])^2*i[2], i=ifactors(n)[2]):

%p seq(a(n), n=1..80); # _Alois P. Heinz_, Aug 05 2017

%t Table[Total[FactorInteger[n] /. {p_, e_} /; p > 0 :> e PrimePi[p]^2], {n, 64}] (* _Michael De Vlieger_, Jul 12 2017 *)

%o (PARI) a(n) = my(f=factor(n)); sum(k=1, #f~, primepi(f[k,1])^2*f[k,2]); \\ _Michel Marcus_, Jul 19 2017

%Y Cf. A003963, A056239, A289507.

%K nonn,look,easy

%O 1,3

%A _Christopher J. Smyth_, Jul 07 2017