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.

A056239 If n = Product_{k >= 1} (p_k)^(c_k) where p_k is k-th prime and c_k >= 0 then a(n) = Sum_{k >= 1} k*c_k.

This page as a plain text file.
%I A056239 #115 Jun 08 2025 16:18:02
%S A056239 0,1,2,2,3,3,4,3,4,4,5,4,6,5,5,4,7,5,8,5,6,6,9,5,6,7,6,6,10,6,11,5,7,
%T A056239 8,7,6,12,9,8,6,13,7,14,7,7,10,15,6,8,7,9,8,16,7,8,7,10,11,17,7,18,12,
%U A056239 8,6,9,8,19,9,11,8,20,7,21,13,8,10,9,9,22,7,8,14,23,8,10,15,12,8,24,8,10
%N A056239 If n = Product_{k >= 1} (p_k)^(c_k) where p_k is k-th prime and c_k >= 0 then a(n) = Sum_{k >= 1} k*c_k.
%C A056239 A pseudo-logarithmic function in the sense that a(b*c) = a(b)+a(c) and so a(b^c) = c*a(b) and f(n) = k^a(n) is a multiplicative function. [Cf. A248692 for example.] Essentially a function from the positive integers onto the partitions of the nonnegative integers (1->0, 2->1, 3->2, 4->1+1, 5->3, 6->1+2, etc.) so each value a(n) appears A000041(a(n)) times, first with the a(n)-th prime and last with the a(n)-th power of 2. Produces triangular numbers from primorials. - _Henry Bottomley_, Nov 22 2001
%C A056239 Michael Nyvang writes (May 08 2006) that the Danish composer Karl Aage Rasmussen discovered this sequence in the 1990's: it has excellent musical properties.
%C A056239 All A000041(a(n)) different n's with the same value a(n) are listed in row a(n) of triangle A215366. - _Alois P. Heinz_, Aug 09 2012
%C A056239 a(n) is the sum of the parts of the partition having Heinz number n. We define the Heinz number of a partition p = [p_1, p_2, ..., p_r] as Product_{j=1..r} (p_j-th prime) (concept used by _Alois P. Heinz_ in A215366 as an "encoding" of a partition). For example, for the partition [1, 1, 2, 4, 10] we get 2*2*3*7*29 = 2436. Example: a(33) = 7 because the partition with Heinz number 33 = 3 * 11 is [2,5]. - _Emeric Deutsch_, May 19 2015
%H A056239 N. J. A. Sloane, <a href="/A056239/b056239.txt">Table of n, a(n) for n = 1..10000</a>
%H A056239 <a href="/index/Pri#prime_indices">Index entries for sequences computed from indices in prime factorization</a>
%F A056239 Totally additive with a(p) = PrimePi(p), where PrimePi(n) = A000720(n).
%F A056239 a(n) = Sum_{k=1..A001221(n)} A049084(A027748(k))*A124010(k). - _Reinhard Zumkeller_, Apr 27 2013
%F A056239 From _Antti Karttunen_, Oct 11 2014: (Start)
%F A056239 a(n) = n - A178503(n).
%F A056239 a(n) = A161511(A156552(n)).
%F A056239 a(n) = A227183(A243354(n)).
%F A056239 For all n >= 0:
%F A056239 a(A002110(n)) = A000217(n). [Cf. _Henry Bottomley_'s comment above.]
%F A056239 a(A005940(n+1)) = A161511(n).
%F A056239 a(A243353(n)) = A227183(n).
%F A056239 Also, for all n >= 1:
%F A056239 a(A241909(n)) = A243503(n).
%F A056239 a(A122111(n)) = a(n).
%F A056239 a(A242424(n)) = a(n).
%F A056239 A248692(n) = 2^a(n). (End)
%F A056239 a(n) < A329605(n), a(n) = A001222(A108951(n)), a(A329902(n)) = A112778(n). - _Antti Karttunen_, Jan 14 2020
%e A056239 a(12) = 1*2 + 2*1 = 4, since 12 = 2^2 *3^1 = (p_1)^2 *(p_2)^1.
%p A056239 # To get 10000 terms. First make prime table: M:=10000; pl:=array(1..M); for i from 1 to M do pl[i]:=0; od: for i from 1 to M do if ithprime(i) > M then break; fi; pl[ithprime(i)]:=i; od:
%p A056239 # Decode Maple's amazing syntax for factoring integers: g:=proc(n) local e,p,t1,t2,t3,i,j,k; global pl; t1:=ifactor(n); t2:=nops(t1); if t2 = 2 and whattype(t1) <> `*` then p:=op(1,op(1,t1)); e:=op(2,t1); t3:=pl[p]*e; else
%p A056239 t3:=0; for i from 1 to t2 do j:=op(i,t1); if nops(j) = 1 then e:=1; p:=op(1,j); else e:=op(2,j); p:=op(1,op(1,j)); fi; t3:=t3+pl[p]*e; od: fi; t3; end; # _N. J. A. Sloane_, May 10 2006
%p A056239 A056239 := proc(n) add( numtheory[pi](op(1,p))*op(2,p), p = ifactors(n)[2]) ; end proc: # _R. J. Mathar_, Apr 20 2010
%p A056239 # alternative:
%p A056239 with(numtheory): a := proc (n) local B: B := proc (n) local nn, j, m: nn := op(2, ifactors(n)): for j to nops(nn) do m[j] := op(j, nn) end do: [seq(seq(pi(op(1, m[i])), q = 1 .. op(2, m[i])), i = 1 .. nops(nn))] end proc: add(B(n)[i], i = 1 .. nops(B(n))) end proc: seq(a(n), n = 1 .. 130); # _Emeric Deutsch_, May 19 2015
%t A056239 a[1] = 0; a[2] = 1; a[p_?PrimeQ] := a[p] = PrimePi[p];
%t A056239 a[n_] := a[n] = Total[#[[2]]*a[#[[1]]] & /@ FactorInteger[n]]; a /@ Range[91] (* _Jean-François Alcover_, May 19 2011 *)
%t A056239 Table[Total[FactorInteger[n] /. {p_, c_} /; p > 0 :> PrimePi[p] c], {n, 91}] (* _Michael De Vlieger_, Jul 12 2017 *)
%o A056239 (Haskell)
%o A056239 a056239 n = sum $ zipWith (*) (map a049084 $ a027748_row n) (a124010_row n)
%o A056239 -- _Reinhard Zumkeller_, Apr 27 2013
%o A056239 (PARI) A056239(n) = if(1==n,0,my(f=factor(n)); sum(i=1, #f~, f[i,2] * primepi(f[i,1]))); \\ _Antti Karttunen_, Oct 26 2014, edited Jan 13 2020
%o A056239 (Scheme)
%o A056239 (require 'factor) ;; Uses the function factor available in Aubrey Jaffer's SLIB Scheme library.
%o A056239 (define (A056239 n) (apply + (map A049084 (factor n))))
%o A056239 ;; _Antti Karttunen_, Oct 26 2014
%o A056239 (Python)
%o A056239 from sympy import primepi, factorint
%o A056239 def A056239(n): return sum(primepi(p)*e for p, e in factorint(n).items()) # _Chai Wah Wu_, Jan 01 2023
%Y A056239 Row sums of A112798.
%Y A056239 Cf. A003963 (gives the corresponding products).
%Y A056239 Cf. also A000041, A000217, A000720, A001221, A001222, A002110, A005940, A008475, A027748, A049084, A060437, A081401, A082090, A088314, A088318, A088850, A088880, A088881, A088887, A088902, A108951, A122111, A124010, A127668, A141128, A153734, A154351, A156552, A163517, A178503, A215366, A215369, A215501, A242422, A242423, A242424, A243070, A243353, A243354, A243503, A248692, A249336, A249337, A329605, A329902.
%K A056239 core,easy,nonn,hear
%O A056239 1,3
%A A056239 _Leroy Quet_, Aug 19 2000