Skip to main content
I explain I do not want to use Select.
Source Link
Peter Burbery
  • 1.9k
  • 5
  • 18

I do not want to use Select to find the solution. I do not need to use Select. I can generate all partitions of an integer into odd parts, then keep merging odd parts until there are no duplicate odd parts left like {3,3,3,1,1,1,1} to {6,3,2,2,} to {6,3,4} to {6,4,3}. Select generates partitions I do not need. That is why I do not want to use it. The partition of an integer into odd parts can be generated with IntegerPartitions[n, Infinity,Range[1, n, 2]] for an integer n. For example,

IntegerPartitions[10, Infinity, Range[1, 10, 2]] 

returns

{{9,1},{7,3},{7,1,1,1},{5,5},{5,3,1,1},{5,1,1,1,1,1},{3,3,3,1},{3,3,1,1,1,1},{3,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1,1,1}} 

I do not want to use Select to find the solution. I do not need to use Select. I can generate all partitions of an integer into odd parts, then keep merging odd parts until there are no duplicate odd parts left like {3,3,3,1,1,1,1} to {6,3,2,2,} to {6,3,4} to {6,4,3}. Select generates partitions I do not need. That is why I do not want to use it. The partition of an integer into odd parts can be generated with IntegerPartitions[n, Infinity,Range[1, n, 2]] for an integer n. For example,

IntegerPartitions[10, Infinity, Range[1, 10, 2]] 

returns

{{9,1},{7,3},{7,1,1,1},{5,5},{5,3,1,1},{5,1,1,1,1,1},{3,3,3,1},{3,3,1,1,1,1},{3,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1,1,1}} 
I fixed a bug where I used Infinity instead of n. For example, won't work IntegerPartitions[13, Infinity, {1, Infinity, 2}], but IntegerPartitions[13, Infinity, {1, 13, 2}] will.
Source Link
Peter Burbery
  • 1.9k
  • 5
  • 18
StrictIntegerPartitions[n_Integer?IntegerQ/;Not[n<=0]]:=OddPartitionsToStrictPartitions[IntegerPartitions[n,Infinity,{1,Infinityn,2}] 
StrictIntegerPartitions[n_Integer?IntegerQ/;Not[n<=0]]:=OddPartitionsToStrictPartitions[IntegerPartitions[n,Infinity,{1,Infinity,2}] 
StrictIntegerPartitions[n_Integer?IntegerQ/;Not[n<=0]]:=OddPartitionsToStrictPartitions[IntegerPartitions[n,Infinity,{1,n,2}] 
I explained that I wanted a function not a hardcoded calculation for 13.
Source Link
Peter Burbery
  • 1.9k
  • 5
  • 18

I would like to design a function StrictIntegerPartitions that lists the strict integer partitions of a strictly positive integer 1 by 1 by one.

The function would be defined as something like this.

StrictIntegerPartitions[n_Integer?IntegerQ/;Not[n<=0]]:=OddPartitionsToStrictPartitions[IntegerPartitions[n,Infinity,{1,Infinity,2}] 

I would like to design a function StrictIntegerPartitions that lists the strict integer partitions of a strictly positive integer 1 by 1 by one.

The function would be defined as something like this.

StrictIntegerPartitions[n_Integer?IntegerQ/;Not[n<=0]]:=OddPartitionsToStrictPartitions[IntegerPartitions[n,Infinity,{1,Infinity,2}] 
Became Hot Network Question
Tags
Source Link
Michael E2
  • 258.7k
  • 21
  • 370
  • 830
Loading
edited title
Link
David G. Stork
  • 43k
  • 3
  • 40
  • 110
Loading
Source Link
Peter Burbery
  • 1.9k
  • 5
  • 18
Loading