A289506 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 + ...
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, 18, 100, 14, 121, 5, 29, 50, 25, 10, 144, 65, 40, 12, 169, 21, 196, 27, 17, 82, 225, 8, 32, 19, 53, 38, 256, 13, 34, 19, 68, 101, 289, 15, 324, 122, 24, 6
Offset: 1
Examples
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. Also a(1) = 0 as n = 1 indexes the empty multiset. Further a(p_k) = k^2 and a(2^r) = r.
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..20000
Programs
-
Maple
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 out:=[0]:for n from 2 to 100 do f:=ifactors(n)[2]; m:=[];for k to nops(f) do pow:=f[k];ind:=primeindex[pow[1]];for e to pow[2] do m:=[op(m),ind];od;od;out:=[op(out),sum(m[jj]^2,jj=1..nops(m))]; od:print(out); # second Maple program: a:= n-> add(numtheory[pi](i[1])^2*i[2], i=ifactors(n)[2]): seq(a(n), n=1..80); # Alois P. Heinz, Aug 05 2017
-
Mathematica
Table[Total[FactorInteger[n] /. {p_, e_} /; p > 0 :> e PrimePi[p]^2], {n, 64}] (* Michael De Vlieger, Jul 12 2017 *)
-
PARI
a(n) = my(f=factor(n)); sum(k=1, #f~, primepi(f[k,1])^2*f[k,2]); \\ Michel Marcus, Jul 19 2017
Formula
For n = Product_k p_k^{r_k}, a(n) = Sum_k k^2 * r_k.
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.
Comments