kill(all)$

Maxima : integer partations with two elements ,setpartdif,version 1.0,appendix
peter.vlasschaert@gmail.com,24/02/2022

load packages
==========

load(nset)$

ref: https://def.fe.up.pt/pipermail/maxima-discuss/2005/010659.html

a) steps needed
---------------------

→set  :

p1:integer_partitions(1,2);

→get list:

p1a:listify(p1);

p1b:p1a[1];
p1b1:p1b[1];
p1b2:p1b[2];

→build code:

p2:length(p1);

p3:copy(p1a);

→code :

for i:1 thru p2 do(
if p1a[i][1]≠ p1a[i][2] then
p3:endcons(reverse(p1a[i]),p3)
)$
p3;

b) definition :setpartdif.
-------------------------------
m1 : must be integer (m1≥0)

setpartdif(m1):=block([],
if m1 = 0 then s3:[0,0] 
    else
(s1:integer_partitions(m1,2),
s2:listify(s1),  
s3:copy(s2), 
     for i:1 thru length(s1) do(
          if s2[i][1]≠ s2[i][2] then
         s3:endcons(reverse(s2[i]),s3)
                                             )
  ),   
    return(s3)
)$

grind(setpartdif)$

(ex)ample : setpartdif
=================
m1=0,1,2,3,4,.............

ex1:setpartdif(0);

ex2:setpartdif(1);
ex3:setpartdif(2);
ex4:setpartdif(3);

ex5:setpartdif(4);