Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#26 2016-05-12 04:48:49

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Combinations and Permutations

But to learn mathematica I would take years and one should have the software.

Yes, I have been working on it since 1997.  There are freeware alternatives that can be used effectively. My friend gAr uses Sage which is in the repositories of Linux. Also, there is WMaxima and Geogebra which are good and in the repositories.

I consider this a computational problem and therefore it is best done with a CAS.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#27 2016-05-13 16:50:49

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,974
Website

Re: Combinations and Permutations

Can I see the C++ code?


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

#28 2016-05-13 19:19:09

thickhead
Member
Registered: 2016-04-16
Posts: 1,086

Re: Combinations and Permutations

Agnishom,
i have replaced [ by /?   and closing  ] by ?/
# include<stdio.h>
#include<conio.h>
#include<iostream.h>




    int R5=0,R2=1,R1=2,c50=3,c20=4,c10=5,c5=6,c2=7,c1=8;

    void changec2(long& count,int counter/?9?/)
    { int counter1/?9?/; // a copy of counter so that upstrem data is not affected.
    for (int i=0;i<9;i++){counter1/?i?/=counter/?i?/;}
     while (counter1/?c2?/>0)
    { counter1/?c2 ?/--;
    counter1/?c1?/+=2;  count++;
    }
    }
     void changec5(long& count,int counter/?9?/)
    { int counter1/?9?/;
    for (int i=0;i<9;i++){counter1/?i?/=counter/?i?/;}

     while (counter1/?c5?/>0)
    { counter1/?c5 ?/--; count++;
    counter1/?c2?/+=2; counter1/?c1?/++;
    changec2(count,counter1);
    counter1/?c5 ?/--; count++;
       counter1/?c2?/+=3;counter1/?c1?/--;
    changec2(count,counter1);

    } }

        void changec10(long& count,int counter/?9?/)
    { int counter1/?9?/;
    for (int i=0;i<9;i++){counter1/?i?/=counter/?i?/;}
    while (counter1/?c10?/>0)
    { counter1/?c10 ?/--; counter1/?c5?/+=2;
    count++;changec5(count,counter1);
    }}
       void changec20(long& count,int counter/?9?/)
    {int counter1/?9?/;
    for (int i=0;i<9;i++){counter1/?i?/=counter/?i?/;}
     while (counter1/?c20?/>0)
    { counter1/?c20 ?/--; counter1/?c10?/+=2;
    count++;changec10(count,counter1);
    } }
    void changec50(long& count,int counter/?9?/)
    {int counter1/?9?/;
    for (int i=0;i<9;i++){counter1/?i?/=counter/?i?/;}
     while (counter1/?c50?/>0)
    { counter1/?c50 ?/--; count++;
    counter1/?c20?/+=2; counter1/?c10?/++; changec10(count,counter1);
    changec20(count,counter1);
    counter1/?c50 ?/--; count++;
    counter1/?c20?/+=3;counter1/?c10?/--;
    changec20(count,counter1);
    } }

    void changeR1(long& count,int counter/?9?/)
    { int counter1/?9?/;
    for (int i=0;i<9;i++){counter1/?i?/=counter/?i?/;}
     while (counter1/?R1?/>0)
    { counter1/?R1?/--; counter1/?c50?/+=2;
    count++;changec50(count,counter1);
    } }
    void changeR2(long& count,int counter/?9?/)
    {int counter1/?9?/;
    for (int i=0;i<9;i++){counter1/?i?/=counter/?i?/;}
    while (counter1/?R2?/>0)
    { counter1/?R2 ?/--; counter1/?R1?/+=2;
    count++;changeR1(count,counter1);
    }}


void changeR5(long& count,int counter/?9?/)
    { int counter1/?9?/;
    for (int i=0;i<9;i++){counter1/?i?/=counter/?i?/;}
    { counter1/?R5 ?/=1;
    counter1/?R2?/=2; counter1/?R1?/=1;count++;changeR2(count,counter1);
    changeR1(count,counter1);
    counter1/?R5?/=0;counter1/?R1?/=0;
     counter1/?R2?/=5; count++;
    changeR2(count,counter1);}
    }
    void main()
    {
     int counter/?9?/={2,0,0,0,0,0,0,0,0};
    long     count=1;
         changeR5(count,counter);
           cout<<"\n\n count= "<<count;
         getch(); // To view the results before proceeding further.
    }


{1}Vasudhaiva Kutumakam.{The whole Universe is a family.}
(2)Yatra naaryasthu poojyanthe Ramanthe tatra Devataha
{Gods rejoice at those places where ladies are respected.}

Offline

#29 2016-05-14 19:49:08

thickhead
Member
Registered: 2016-04-16
Posts: 1,086

Re: Combinations and Permutations


the brackets ] and [ have been replaced by $


{1}Vasudhaiva Kutumakam.{The whole Universe is a family.}
(2)Yatra naaryasthu poojyanthe Ramanthe tatra Devataha
{Gods rejoice at those places where ladies are respected.}

Offline

#30 2016-05-15 00:59:01

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,974
Website

Re: Combinations and Permutations

That is a lot of code!


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

Board footer

Powered by FluxBB