Skip to content

PrimePartitions ​

The partitions of nn into prime parts.

PrimePartitions(n)the partitions of nn into prime parts
Typed signatures
TypePackageApplies
(integer<0..>) -> indexed_collection<integer_partition>combinatoricsalways

Domain: Collections

Details
  • Count is A000607.

Definition

Epsil, as the implementation runs it.

count(_n)

_tables[_n * (_n + 1) + _n + 1]

unrank(_n, _r)

Drop(Fold(
           Function(Apply((pw_m: integer) => Apply((pw_c: integer) => Apply((pw_r: integer) => pw_u if pw_m == 0 else Apply(
                                                                                                                             (pw_chosen: list<integer>) => Join(
                                                                                                                                                                 [pw_m - pw_chosen[2], pw_chosen[2], pw_chosen[1]],
                                                                                                                                                                 Drop(pw_u, 3),
                                                                                                                                                                 [pw_chosen[2]],
                                                                                                                                                               ),
                                                                                                                             Fold(
                                                                                                                                   Function(pw_pick if pw_pick[2] != 0 else Apply(
                                                                                                                                                                                   (pw_k: integer) => [pw_pick[1], pw_p] if pw_pick[1] < pw_k else [pw_pick[1] - pw_k, 0],
                                                                                                                                                                                   _tables[(pw_m - pw_p) *
                                                                                                                                                                                           (_n + 1) + pw_p + 1],
                                                                                                                                                                                 ) if pw_p >= 2 &&
                                                                                                                                                                                     Fold(Function(ok_pr_d &&
                                                                                                                                                                                                   pw_p % pr_d !=
                                                                                                                                                                                                   0, ok_pr_d, pr_d), True, Range(2, pw_p - 1, 1)) else pw_pick, pw_pick, pw_p),
                                                                                                                                   [pw_r, 0],
                                                                                                                                   Range(Min(pw_m, pw_c), 1, -1),
                                                                                                                                 ),
                                                                                                                           ), pw_u[3]), pw_u[2]), pw_u[1]), pw_u, pw_i),
           [_n, _n, _r],
           Range(1, _n, 1),
         ), 3)

rank(_n, _x)

Fold(
      Function(Apply((pw_r: integer) => Apply((pw_m: integer) => Apply((pw_c: integer) => [pw_r +
                                                                                           Fold(
                                                                                                 Function(pw_s +
                                                                                                          (_tables[(pw_m - pw_q) *
                                                                                                                   (_n + 1) + pw_q + 1] if pw_q >= 2 &&
                                                                                                                                   Fold(
                                                                                                                                         Function(ok_pr_d &&
                                                                                                                                                  pw_q % pr_d !=
                                                                                                                                                  0, ok_pr_d, pr_d),
                                                                                                                                         True,
                                                                                                                                         Range(2, pw_q - 1, 1),
                                                                                                                                       ) else 0), pw_s, pw_q),
                                                                                                 0,
                                                                                                 Range(
                                                                                                        pw_x + 1,
                                                                                                        Min(pw_m, pw_c),
                                                                                                        1,
                                                                                                      ),
                                                                                               ), pw_m - pw_x, pw_x], pw_a[3]), pw_a[2]), pw_a[1]), pw_a, pw_x),
      [0, _n, _n],
      _x,
    )[1]

valid(_n, _x)

Apply(
       (pw_end: list<integer>) => pw_end[1] == 1 && pw_end[2] == 0 && 1 != 0,
       Fold(
             Function(Apply((pw_f: integer) => Apply((pw_m: integer) => Apply(
                                                                               (pw_c: integer) => [1, pw_m - pw_y, pw_y] if pw_f == 1 &&
                                                                                                                            pw_y >= 1 &&
                                                                                                                            pw_y <=
                                                                                                                            Min(pw_m, pw_c) &&
                                                                                                                            pw_y >= 2 &&
                                                                                                                            Fold(
                                                                                                                                  Function(ok_pr_d &&
                                                                                                                                           pw_y % pr_d !=
                                                                                                                                           0, ok_pr_d, pr_d),
                                                                                                                                  True,
                                                                                                                                  Range(2, pw_y - 1, 1),
                                                                                                                                ) else [0, 0, 0],
                                                                               pw_v[3],
                                                                             ), pw_v[2]), pw_v[1]), pw_v, pw_y),
             [1, _n, _n],
             _x,
           ),
     )

tables(_n)

Fold(
      Function(Join(
                     pw_t,
                     Fold(
                           Function(
                                     ReplaceAt(
                                                pw_row,
                                                pw_c + 1,
                                                Fold(
                                                      Function(pw_a +
                                                               (pw_t[(pw_s -
                                                                      pw_p) * (_n +
                                                                           1) +
                                                                     pw_p + 1] if pw_p >=
                                                                          2 &&
                                                                          Fold(
                                                                                Function(ok_pr_d &&
                                                                                         pw_p % pr_d !=
                                                                                         0, ok_pr_d, pr_d),
                                                                                True,
                                                                                Range(2, pw_p - 1, 1),
                                                                              ) else 0), pw_a, pw_p),
                                                      0,
                                                      Range(
                                                             1,
                                                             Min(pw_s, pw_c),
                                                             1,
                                                           ),
                                                    ),
                                              ),
                                     pw_row,
                                     pw_c,
                                   ),
                           Map(Function(0, pw_z), Range(0, _n + 1 - 1, 1)),
                           Range(0, _n + 1 - 1, 1),
                         ),
                   ), pw_t, pw_s),
      Fold(
            Function(ReplaceAt(pw_row, pw_c + 1, 1), pw_row, pw_c),
            Map(Function(0, pw_z), Range(0, _n + 1 - 1, 1)),
            Range(0, _n + 1 - 1, 1),
          ),
      Range(1, _n + 1 - 1, 1),
    )

Statistics

On IntegerPartition, called as CombinatorialStat(x, "Name").

Maps

Into and out of IntegerPartition, called as CombinatorialMap(x, "Name"). Properties are the laws we state and what FindStat records.

From IntegerPartition

  • BinaryWordIntegerPartition → BinaryWordInjectionMp00095The shape's boundary read from the first row down: 1 for a step down, 0 for a step left.
  • BulgarianSolitaireIntegerPartition → IntegerPartitionGraded mapMp00308A move of Bulgarian solitaire: the first column of the Ferrers diagram becomes a new row.
  • GlaisherFranklinIntegerPartition → IntegerPartitionbijectioninverseBijectionGraded mapMp00312The Glaisher-Franklin bijection: even part sizes halved become repeated parts, and repeated odd parts merge into their binary multiples.
  • InitialTableauIntegerPartition → StandardTableauInjectionGraded mapMp00042The standard tableau of the shape filled row by row with 1, 2, ..., n.
  • InverseGlaisherFranklinIntegerPartition → IntegerPartitionbijectioninverseBijectionGraded mapMp00313The inverse of GlaisherFranklin: repeated parts merge into doubled parts, and a leftover part splits into copies of its odd part.
  • MinimalDyckPathIntegerPartition → DyckPathInjectionMp00043The shortest Dyck path tracing the shape of the Ferrers diagram.
  • OddPartsWordIntegerPartition → BinaryWordSurjectionMp00317The binary word marking which parts are odd, the parts taken largest first.
  • ParallelogramPolyominoDyckPathIntegerPartition → DyckPathInjectionMp00230The Dyck path of the partition read as a parallelogram polyomino, one column per part.
  • ReadingTableauIntegerPartition → StandardTableauInjectionGraded mapMp00045The recording tableau of the row reading word of the shape filled row by row.
  • RemoveFirstPartIntegerPartition → IntegerPartitionSurjectionMp00202The partition without its largest part: its first row removed.
  • TransposePartitionIntegerPartition → IntegerPartitioninvolutionBijectionGraded mapInvolutionMp00044The conjugate partition: column i of the Ferrers diagram becomes row i.

To IntegerPartition

  • BlockSizePartitionSetPartition → IntegerPartitionsurjectionSurjectionGraded mapMp00079The partition of n a set partition's block sizes form, largest first.
  • ConjugateAfterCycleTypePermutation → IntegerPartitionThe conjugate partition of the cycle type.
  • CutOutPartitionDyckPath → IntegerPartitionInjectionMp00027The partition cut out of the staircase by the path: part i is the number of downs before the (n + 1 - i)-th up step.
  • CycleTypePermutation → IntegerPartitionsurjectionSurjectionGraded mapMp00108The multiset of cycle lengths, as a partition.
  • NegativeCycleTypeSignedPermutation → IntegerPartitionSurjectionMp00169The lengths of the negative cycles, largest first: those of the underlying permutation with an odd number of negative entries.
  • PositiveCycleTypeSignedPermutation → IntegerPartitionSurjectionMp00166The lengths of the positive cycles, largest first: those of the underlying permutation with an even number of negative entries.
  • RskShapePermutation → IntegerPartitionsurjectionSurjectionGraded mapMp00060The common shape of the RSK tableaux: the row lengths, as a partition of n.
  • SortedPartitionIntegerComposition → IntegerPartitionsurjectionSurjectionGraded mapMp00040The partition a composition's parts form, sorted largest first.
  • TableauShapeStandardTableau → IntegerPartitionsurjectionSurjectionGraded mapMp00083The shape of a standard tableau: its row lengths.
21 more in FindStat, not implemented here
  • Mp00021CorePartition → IntegerPartitionGraded mapBijectionto bounded partition
  • Mp00022CorePartition → IntegerPartitionSurjectionto partition
  • Mp00037LabeledGraph → IntegerPartitionSurjectionGraded mapto partition of connected components
  • Mp00077SemistandardTableau → IntegerPartitionSurjectionGraded mapshape
  • Mp00110Posets → IntegerPartitionSurjectionGraded mapGreene-Kleitman invariant
  • Mp00179IntegerPartition → SkewPartitionInjectionGraded mapto skew partition
  • Mp00182SkewPartition → IntegerPartitionSurjectionouter shape
  • Mp00183SkewPartition → IntegerPartitionSurjectioninner shape
  • Mp00186SkewPartition → IntegerPartitionSurjectionGraded mapdominating partition
  • Mp00204Permutation → IntegerPartitionSurjectionGraded mapLLPS
  • Mp00225SemistandardTableau → IntegerPartitionSurjectionweight
  • Mp00251LabeledGraph → IntegerPartitionclique sizes
  • Mp00275LabeledGraph → IntegerPartitionSurjectionto edge-partition of connected components
  • Mp00276LabeledGraph → IntegerPartitionto edge-partition of biconnected components
  • Mp00306Posets → IntegerPartitionrowmotion cycle type
  • Mp00307Posets → IntegerPartitionpromotion cycle type
  • Mp00311PlanePartition → IntegerPartitionGraded mapto partition
  • Mp00321IntegerPartition → IntegerPartitionBijectionGraded mapInvolution2-conjugate
  • Mp00322IntegerPartition → IntegerPartitionBijectionGraded mapLoehr-Warrington
  • Mp00323IntegerPartition → IntegerPartitionBijectionGraded mapLoehr-Warrington inverse
  • Mp00332Posets → IntegerPartitionSurjectionGraded mapJordan block partition

Enumeration

Examples

1 more kept as data, checked against the oracles
Basic #

Count(PrimePartitions(12))=7Count(PrimePartitions(12)) = 7

live ↗
InCount(PrimePartitions(12))\mathrm{Count}(\mathrm{PrimePartitions}(12))Out77

The first element in enumeration order

live ↗
InPrimePartitions(12)[1]\mathrm{PrimePartitions}(12)[1]OutIntegerPartition⁡([7,5]){\operatorname{IntegerPartition}}([7, 5])
About
Examples3
CrosswalkOEIS

See also: IntegerPartitions