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.

Showing 1-2 of 2 results.

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.

Original entry on oeis.org

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, 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, 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
Offset: 1

Views

Author

Leroy Quet, Aug 19 2000

Keywords

Comments

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
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.
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
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

Examples

			a(12) = 1*2 + 2*1 = 4, since 12 = 2^2 *3^1 = (p_1)^2 *(p_2)^1.
		

Crossrefs

Programs

  • Haskell
    a056239 n = sum $ zipWith (*) (map a049084 $ a027748_row n) (a124010_row n)
    -- Reinhard Zumkeller, Apr 27 2013
    
  • Maple
    # 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:
    # 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
    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
    A056239 := proc(n) add( numtheory[pi](op(1,p))*op(2,p), p = ifactors(n)[2]) ; end proc: # R. J. Mathar, Apr 20 2010
    # alternative:
    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
  • Mathematica
    a[1] = 0; a[2] = 1; a[p_?PrimeQ] := a[p] = PrimePi[p];
    a[n_] := a[n] = Total[#[[2]]*a[#[[1]]] & /@ FactorInteger[n]]; a /@ Range[91] (* Jean-François Alcover, May 19 2011 *)
    Table[Total[FactorInteger[n] /. {p_, c_} /; p > 0 :> PrimePi[p] c], {n, 91}] (* Michael De Vlieger, Jul 12 2017 *)
  • 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
    
  • Python
    from sympy import primepi, factorint
    def A056239(n): return sum(primepi(p)*e for p, e in factorint(n).items()) # Chai Wah Wu, Jan 01 2023
  • Scheme
    (require 'factor) ;; Uses the function factor available in Aubrey Jaffer's SLIB Scheme library.
    (define (A056239 n) (apply + (map A049084 (factor n))))
    ;; Antti Karttunen, Oct 26 2014
    

Formula

Totally additive with a(p) = PrimePi(p), where PrimePi(n) = A000720(n).
a(n) = Sum_{k=1..A001221(n)} A049084(A027748(k))*A124010(k). - Reinhard Zumkeller, Apr 27 2013
From Antti Karttunen, Oct 11 2014: (Start)
a(n) = n - A178503(n).
a(n) = A161511(A156552(n)).
a(n) = A227183(A243354(n)).
For all n >= 0:
a(A002110(n)) = A000217(n). [Cf. Henry Bottomley's comment above.]
a(A005940(n+1)) = A161511(n).
a(A243353(n)) = A227183(n).
Also, for all n >= 1:
a(A241909(n)) = A243503(n).
a(A122111(n)) = a(n).
a(A242424(n)) = a(n).
A248692(n) = 2^a(n). (End)
a(n) < A329605(n), a(n) = A001222(A108951(n)), a(A329902(n)) = A112778(n). - Antti Karttunen, Jan 14 2020

A215366 Triangle T(n,k) read by rows in which n-th row lists in increasing order all partitions lambda of n encoded as Product_{i in lambda} prime(i); n>=0, 1<=k<=A000041(n).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 8, 7, 9, 10, 12, 16, 11, 14, 15, 18, 20, 24, 32, 13, 21, 22, 25, 27, 28, 30, 36, 40, 48, 64, 17, 26, 33, 35, 42, 44, 45, 50, 54, 56, 60, 72, 80, 96, 128, 19, 34, 39, 49, 52, 55, 63, 66, 70, 75, 81, 84, 88, 90, 100, 108, 112, 120, 144, 160, 192, 256
Offset: 0

Views

Author

Alois P. Heinz, Aug 08 2012

Keywords

Comments

The concatenation of all rows (with offset 1) gives a permutation of the natural numbers A000027 with fixed points 1-6, 9, 10, 14, 15, 21, 22, 33, 49, 1095199, ... and inverse permutation A215501.
Number m is positioned in row n = A056239(m). The number of different values m, such that both m and m+1 occur in row n is A088850(n). A215369 lists all values m, such that both m and m+1 are in the same row.
The power prime(i)^j of the i-th prime is in row i*j for j in {0,1,2, ... }.
Column k=2 contains the even semiprimes A100484, where 10 and 22 are replaced by the odd semiprimes 9 and 21, respectively.
This triangle is related to the triangle A145518, see in both triangles the first column, the right border, the second right border and the row sums. - Omar E. Pol, May 18 2015

Examples

			The partitions of n=3 are {[3], [2,1], [1,1,1]}, encodings give {prime(3), prime(2)*prime(1), prime(1)^3} = {5, 3*2, 2^3} => row 3 = [5, 6, 8].
For n=0 the empty partition [] gives the empty product 1.
Triangle T(n,k) begins:
   1;
   2;
   3,  4;
   5,  6,  8;
   7,  9, 10, 12, 16;
  11, 14, 15, 18, 20, 24, 32;
  13, 21, 22, 25, 27, 28, 30, 36, 40, 48, 64;
  17, 26, 33, 35, 42, 44, 45, 50, 54, 56, 60, 72, 80, 96, 128;
  ...
Corresponding triangle of integer partitions begins:
  ();
  1;
  2, 11;
  3, 21, 111;
  4, 22, 31, 211, 1111;
  5, 41, 32, 221, 311, 2111, 11111;
  6, 42, 51, 33, 222, 411, 321, 2211, 3111, 21111, 111111;
  7, 61, 52, 43, 421, 511, 322, 331, 2221, 4111, 3211, 22111, 31111, 211111, 1111111;  - _Gus Wiseman_, Dec 12 2016
		

Crossrefs

Column k=1 gives: A008578(n+1).
Last elements of rows give: A000079.
Second to last elements of rows give: A007283(n-2) for n>1.
Row sums give: A145519.
Row lengths are: A000041.
Cf. A129129 (with row elements using order of A080577).
LCM of terms in row n gives A138534(n).
Cf. A112798, A246867 (the same for partitions into distinct parts).

Programs

  • Maple
    b:= proc(n, i) option remember; `if`(n=0 or i<2, [2^n],
           [seq(map(p->p*ithprime(i)^j, b(n-i*j, i-1))[], j=0..n/i)])
        end:
    T:= n-> sort(b(n, n))[]:
    seq(T(n), n=0..10);
    # (2nd Maple program)
    with(combinat): A := proc (n) local P, A, i: P := partition(n): A := {}; for i to nops(P) do A := `union`(A, {mul(ithprime(P[i][j]), j = 1 .. nops(P[i]))}) end do: A end proc; # the command A(m) yields row m. # Emeric Deutsch, Jan 23 2016
    # (3rd Maple program)
    q:= 7: S[0] := {1}: for m to q do S[m] := `union`(seq(map(proc (f) options operator, arrow: ithprime(j)*f end proc, S[m-j]), j = 1 .. m)) end do; # for a given positive integer q, the program yields rows 0, 1, 2,...,q. # Emeric Deutsch, Jan 23 2016
  • Mathematica
    b[n_, i_] := b[n, i] = If[n == 0 || i<2, {2^n}, Table[Function[#*Prime[i]^j] /@ b[n - i*j, i-1], {j, 0, n/i}] // Flatten]; T[n_] := Sort[b[n, n]]; Table[T[n], {n, 0, 10}] // Flatten (* Jean-François Alcover, Mar 12 2015, after Alois P. Heinz *)
    nn=7;HeinzPartition[n_]:=If[n===1,{},Flatten[Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]]//Reverse];
    Take[GatherBy[Range[2^nn],Composition[Total,HeinzPartition]],nn+1] (* Gus Wiseman, Dec 12 2016 *)
    Table[Map[Times @@ Prime@ # &, IntegerPartitions[n]], {n, 0, 8}] // Flatten (* Michael De Vlieger, Jul 12 2017 *)
  • PARI
    \\ From M. F. Hasler, Dec 06 2016 (Start)
    A215366_row(n)=vecsort([vecprod([prime(p)|p<-P])|P<-partitions(n)]) \\ bug fix & syntax update by M. F. Hasler, Oct 20 2023
    A215366_vec(N)=concat(apply(A215366_row,[0..N])) \\ "flattened" rows 0..N (End)

Formula

Recurrence relation, explained for the set S(4) of entries in row 4: multiply the entries of S(3) by 2 (= 1st prime), multiply the entries of S(2) by 3 (= 2nd prime), multiply the entries of S(1) by 5 (= 3rd prime), multiply the entries of S(0) by 7 (= 4th prime); take the union of all the obtained products. The 3rd Maple program is based on this recurrence relation. - Emeric Deutsch, Jan 23 2016
Showing 1-2 of 2 results.