How many combinations does Android pattern have?











up vote
5
down vote

favorite
4












Example



Rules-
1) At-least 4 and at-max 9 dots must be connected.
2) There can be no jumpsenter image description here



3) Once a dot is crossed, you can jump over it.










share|cite|improve this question






















  • stackoverflow.com/questions/6979524/…
    – user61527
    Jan 11 '14 at 6:31










  • @T.Bongers - This being a math site, maybe someone here will come up with a less "brute force" method.
    – nbubis
    Jan 11 '14 at 6:57










  • Is 12364 possible by backtracking 1236(321)4?
    – Peter Taylor
    Jan 11 '14 at 11:35










  • 1236(321)4 is not possible as between 6 and 4 is 5. However, this is possible- 51236(5)4
    – travis bickle
    Jan 11 '14 at 11:51












  • It's not clear whether a crossed dot that is jumped over later is counted. For example is 21(2)3654789 counted as 10 dots and hence not allowed? If so, there is a relatively simple mathematical way to find the answer.
    – user21820
    Aug 16 '14 at 8:32















up vote
5
down vote

favorite
4












Example



Rules-
1) At-least 4 and at-max 9 dots must be connected.
2) There can be no jumpsenter image description here



3) Once a dot is crossed, you can jump over it.










share|cite|improve this question






















  • stackoverflow.com/questions/6979524/…
    – user61527
    Jan 11 '14 at 6:31










  • @T.Bongers - This being a math site, maybe someone here will come up with a less "brute force" method.
    – nbubis
    Jan 11 '14 at 6:57










  • Is 12364 possible by backtracking 1236(321)4?
    – Peter Taylor
    Jan 11 '14 at 11:35










  • 1236(321)4 is not possible as between 6 and 4 is 5. However, this is possible- 51236(5)4
    – travis bickle
    Jan 11 '14 at 11:51












  • It's not clear whether a crossed dot that is jumped over later is counted. For example is 21(2)3654789 counted as 10 dots and hence not allowed? If so, there is a relatively simple mathematical way to find the answer.
    – user21820
    Aug 16 '14 at 8:32













up vote
5
down vote

favorite
4









up vote
5
down vote

favorite
4






4





Example



Rules-
1) At-least 4 and at-max 9 dots must be connected.
2) There can be no jumpsenter image description here



3) Once a dot is crossed, you can jump over it.










share|cite|improve this question













Example



Rules-
1) At-least 4 and at-max 9 dots must be connected.
2) There can be no jumpsenter image description here



3) Once a dot is crossed, you can jump over it.







combinatorics permutations combinations






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Jan 11 '14 at 6:29









travis bickle

262




262












  • stackoverflow.com/questions/6979524/…
    – user61527
    Jan 11 '14 at 6:31










  • @T.Bongers - This being a math site, maybe someone here will come up with a less "brute force" method.
    – nbubis
    Jan 11 '14 at 6:57










  • Is 12364 possible by backtracking 1236(321)4?
    – Peter Taylor
    Jan 11 '14 at 11:35










  • 1236(321)4 is not possible as between 6 and 4 is 5. However, this is possible- 51236(5)4
    – travis bickle
    Jan 11 '14 at 11:51












  • It's not clear whether a crossed dot that is jumped over later is counted. For example is 21(2)3654789 counted as 10 dots and hence not allowed? If so, there is a relatively simple mathematical way to find the answer.
    – user21820
    Aug 16 '14 at 8:32


















  • stackoverflow.com/questions/6979524/…
    – user61527
    Jan 11 '14 at 6:31










  • @T.Bongers - This being a math site, maybe someone here will come up with a less "brute force" method.
    – nbubis
    Jan 11 '14 at 6:57










  • Is 12364 possible by backtracking 1236(321)4?
    – Peter Taylor
    Jan 11 '14 at 11:35










  • 1236(321)4 is not possible as between 6 and 4 is 5. However, this is possible- 51236(5)4
    – travis bickle
    Jan 11 '14 at 11:51












  • It's not clear whether a crossed dot that is jumped over later is counted. For example is 21(2)3654789 counted as 10 dots and hence not allowed? If so, there is a relatively simple mathematical way to find the answer.
    – user21820
    Aug 16 '14 at 8:32
















stackoverflow.com/questions/6979524/…
– user61527
Jan 11 '14 at 6:31




stackoverflow.com/questions/6979524/…
– user61527
Jan 11 '14 at 6:31












@T.Bongers - This being a math site, maybe someone here will come up with a less "brute force" method.
– nbubis
Jan 11 '14 at 6:57




@T.Bongers - This being a math site, maybe someone here will come up with a less "brute force" method.
– nbubis
Jan 11 '14 at 6:57












Is 12364 possible by backtracking 1236(321)4?
– Peter Taylor
Jan 11 '14 at 11:35




Is 12364 possible by backtracking 1236(321)4?
– Peter Taylor
Jan 11 '14 at 11:35












1236(321)4 is not possible as between 6 and 4 is 5. However, this is possible- 51236(5)4
– travis bickle
Jan 11 '14 at 11:51






1236(321)4 is not possible as between 6 and 4 is 5. However, this is possible- 51236(5)4
– travis bickle
Jan 11 '14 at 11:51














It's not clear whether a crossed dot that is jumped over later is counted. For example is 21(2)3654789 counted as 10 dots and hence not allowed? If so, there is a relatively simple mathematical way to find the answer.
– user21820
Aug 16 '14 at 8:32




It's not clear whether a crossed dot that is jumped over later is counted. For example is 21(2)3654789 counted as 10 dots and hence not allowed? If so, there is a relatively simple mathematical way to find the answer.
– user21820
Aug 16 '14 at 8:32










2 Answers
2






active

oldest

votes

















up vote
0
down vote













I think it's impossible to find it in a combinatory way, I used a recursive research to find it and it gave me the answer 487272. Under there is the c++ code. But a lot of sites posts a lesser answer, 389112. I'd like to see a more matematical way to solve this.



#include <iostream>
#include <stdlib.h>
using namespace std;

int combo; //counter

void research(int Ipoints /*number of points already took*/, bool Icheck[9]/*points matrix*/,int Ilast/*last took point*/,
int Icomboval/*combination representation, only for printing purpose*/, int deep/*number of iteration, only for printing purpose*/)
{

// int numcall = 0; //DEBUG


for( int i=0; i<9; i++) //Controlling every free point in search of a valid way to contimue
if( Icheck[i] == false )
{
//Just for security, coping every variable in a new variable. I don't know how c++ works but I will make it works
int points = Ipoints;
int last = Ilast;
int comboval = Icomboval;
bool check[9];
for( int j=0; j<9; j++)
check[j] = Icheck[j];

int e1,e2;
int middle = -1;
e1=i; e2=last; //Controlling duble jumps
if( e1 == 0 && e2 == 2 ) middle = 1;
if( e1 == 3 && e2 == 5 ) middle = 4;
if( e1 == 6 && e2 == 8 ) middle = 7;
if( e1 == 0 && e2 == 6 ) middle = 3;
if( e1 == 1 && e2 == 7 ) middle = 4;
if( e1 == 2 && e2 == 8 ) middle = 5;
if( e1 == 0 && e2 == 8 ) middle = 4;
if( e1 == 6 && e2 == 2 ) middle = 4;

e2=i; e1=last; // in both way
if( e1 == 0 && e2 == 2 ) middle = 1;
if( e1 == 3 && e2 == 5 ) middle = 4;
if( e1 == 6 && e2 == 8 ) middle = 7;
if( e1 == 0 && e2 == 6 ) middle = 3;
if( e1 == 1 && e2 == 7 ) middle = 4;
if( e1 == 2 && e2 == 8 ) middle = 5;
if( e1 == 0 && e2 == 8 ) middle = 4;
if( e1 == 6 && e2 == 2 ) middle = 4;

if((middle != -1) && !(check[middle])) {
check[middle] = true;
points++; //adding middle points
comboval *= 10;
comboval += middle;
}

check[i] = true;
points++; // get the point

comboval*=10;
comboval += i+1;

if(points > 3)
{
combo++; // every iteration over tree points is a valid combo

// If you want to see they all, beware because printing they all is truly slow:
// cout << "Combination n. " << combo << " found: " << comboval << " , points " << points << " with " << deep << " iterationsn";
}

if(points > 9) //Just for sure, emergency shutdown,
{ exit(1); }


research(points,check,i,comboval,deep+1); /*Recursive, here is the true program!*/

// numcall++; //DEBUG
}

// cout << "Ended " << deep << " , with " << numcall << " subs calledn"; // Only for debug purposes,remove with all the //DEBUG thing

}



int main ()
{
combo = 0; //no initial knows combo
bool checkerboard[9];
for( int i=0; i<9; i++) checkerboard[i]=false; //blank initial pattern

research(0/*no point taken*/,checkerboard,-1/*just a useless value*/,0/*blank combo*/,1/*it's the firs iteration*/); //let's search!

cout << "n" ;
cout << "And the answer is ... " << combo << "n"; //out

char ans='';
while(ans=='')
{ //just waiting
cin >> ans;
}

return 0;
}





share|cite|improve this answer





















  • Please add more details, what are you trying to find here?
    – Petite Etincelle
    Aug 16 '14 at 8:42






  • 1




    This is a brute-force search and is a valid approach. However it does not show any mathematical way of approaching the answer. This should probably be CW.
    – Ali Caglayan
    Aug 16 '14 at 10:39


















up vote
-2
down vote













I try with combinatorics addition and multiplication principle. I just share my try. if there is any improvement, please suggest.enter image description here






share|cite|improve this answer





















  • Your solution does not implement the requirement of no jumps. For example starting from button 1 you cant go straight to 3,6,7,8,9, but only to 2,4 and 5.
    – Jaroslaw Matlak
    Oct 19 at 12:33











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f634437%2fhow-many-combinations-does-android-pattern-have%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













I think it's impossible to find it in a combinatory way, I used a recursive research to find it and it gave me the answer 487272. Under there is the c++ code. But a lot of sites posts a lesser answer, 389112. I'd like to see a more matematical way to solve this.



#include <iostream>
#include <stdlib.h>
using namespace std;

int combo; //counter

void research(int Ipoints /*number of points already took*/, bool Icheck[9]/*points matrix*/,int Ilast/*last took point*/,
int Icomboval/*combination representation, only for printing purpose*/, int deep/*number of iteration, only for printing purpose*/)
{

// int numcall = 0; //DEBUG


for( int i=0; i<9; i++) //Controlling every free point in search of a valid way to contimue
if( Icheck[i] == false )
{
//Just for security, coping every variable in a new variable. I don't know how c++ works but I will make it works
int points = Ipoints;
int last = Ilast;
int comboval = Icomboval;
bool check[9];
for( int j=0; j<9; j++)
check[j] = Icheck[j];

int e1,e2;
int middle = -1;
e1=i; e2=last; //Controlling duble jumps
if( e1 == 0 && e2 == 2 ) middle = 1;
if( e1 == 3 && e2 == 5 ) middle = 4;
if( e1 == 6 && e2 == 8 ) middle = 7;
if( e1 == 0 && e2 == 6 ) middle = 3;
if( e1 == 1 && e2 == 7 ) middle = 4;
if( e1 == 2 && e2 == 8 ) middle = 5;
if( e1 == 0 && e2 == 8 ) middle = 4;
if( e1 == 6 && e2 == 2 ) middle = 4;

e2=i; e1=last; // in both way
if( e1 == 0 && e2 == 2 ) middle = 1;
if( e1 == 3 && e2 == 5 ) middle = 4;
if( e1 == 6 && e2 == 8 ) middle = 7;
if( e1 == 0 && e2 == 6 ) middle = 3;
if( e1 == 1 && e2 == 7 ) middle = 4;
if( e1 == 2 && e2 == 8 ) middle = 5;
if( e1 == 0 && e2 == 8 ) middle = 4;
if( e1 == 6 && e2 == 2 ) middle = 4;

if((middle != -1) && !(check[middle])) {
check[middle] = true;
points++; //adding middle points
comboval *= 10;
comboval += middle;
}

check[i] = true;
points++; // get the point

comboval*=10;
comboval += i+1;

if(points > 3)
{
combo++; // every iteration over tree points is a valid combo

// If you want to see they all, beware because printing they all is truly slow:
// cout << "Combination n. " << combo << " found: " << comboval << " , points " << points << " with " << deep << " iterationsn";
}

if(points > 9) //Just for sure, emergency shutdown,
{ exit(1); }


research(points,check,i,comboval,deep+1); /*Recursive, here is the true program!*/

// numcall++; //DEBUG
}

// cout << "Ended " << deep << " , with " << numcall << " subs calledn"; // Only for debug purposes,remove with all the //DEBUG thing

}



int main ()
{
combo = 0; //no initial knows combo
bool checkerboard[9];
for( int i=0; i<9; i++) checkerboard[i]=false; //blank initial pattern

research(0/*no point taken*/,checkerboard,-1/*just a useless value*/,0/*blank combo*/,1/*it's the firs iteration*/); //let's search!

cout << "n" ;
cout << "And the answer is ... " << combo << "n"; //out

char ans='';
while(ans=='')
{ //just waiting
cin >> ans;
}

return 0;
}





share|cite|improve this answer





















  • Please add more details, what are you trying to find here?
    – Petite Etincelle
    Aug 16 '14 at 8:42






  • 1




    This is a brute-force search and is a valid approach. However it does not show any mathematical way of approaching the answer. This should probably be CW.
    – Ali Caglayan
    Aug 16 '14 at 10:39















up vote
0
down vote













I think it's impossible to find it in a combinatory way, I used a recursive research to find it and it gave me the answer 487272. Under there is the c++ code. But a lot of sites posts a lesser answer, 389112. I'd like to see a more matematical way to solve this.



#include <iostream>
#include <stdlib.h>
using namespace std;

int combo; //counter

void research(int Ipoints /*number of points already took*/, bool Icheck[9]/*points matrix*/,int Ilast/*last took point*/,
int Icomboval/*combination representation, only for printing purpose*/, int deep/*number of iteration, only for printing purpose*/)
{

// int numcall = 0; //DEBUG


for( int i=0; i<9; i++) //Controlling every free point in search of a valid way to contimue
if( Icheck[i] == false )
{
//Just for security, coping every variable in a new variable. I don't know how c++ works but I will make it works
int points = Ipoints;
int last = Ilast;
int comboval = Icomboval;
bool check[9];
for( int j=0; j<9; j++)
check[j] = Icheck[j];

int e1,e2;
int middle = -1;
e1=i; e2=last; //Controlling duble jumps
if( e1 == 0 && e2 == 2 ) middle = 1;
if( e1 == 3 && e2 == 5 ) middle = 4;
if( e1 == 6 && e2 == 8 ) middle = 7;
if( e1 == 0 && e2 == 6 ) middle = 3;
if( e1 == 1 && e2 == 7 ) middle = 4;
if( e1 == 2 && e2 == 8 ) middle = 5;
if( e1 == 0 && e2 == 8 ) middle = 4;
if( e1 == 6 && e2 == 2 ) middle = 4;

e2=i; e1=last; // in both way
if( e1 == 0 && e2 == 2 ) middle = 1;
if( e1 == 3 && e2 == 5 ) middle = 4;
if( e1 == 6 && e2 == 8 ) middle = 7;
if( e1 == 0 && e2 == 6 ) middle = 3;
if( e1 == 1 && e2 == 7 ) middle = 4;
if( e1 == 2 && e2 == 8 ) middle = 5;
if( e1 == 0 && e2 == 8 ) middle = 4;
if( e1 == 6 && e2 == 2 ) middle = 4;

if((middle != -1) && !(check[middle])) {
check[middle] = true;
points++; //adding middle points
comboval *= 10;
comboval += middle;
}

check[i] = true;
points++; // get the point

comboval*=10;
comboval += i+1;

if(points > 3)
{
combo++; // every iteration over tree points is a valid combo

// If you want to see they all, beware because printing they all is truly slow:
// cout << "Combination n. " << combo << " found: " << comboval << " , points " << points << " with " << deep << " iterationsn";
}

if(points > 9) //Just for sure, emergency shutdown,
{ exit(1); }


research(points,check,i,comboval,deep+1); /*Recursive, here is the true program!*/

// numcall++; //DEBUG
}

// cout << "Ended " << deep << " , with " << numcall << " subs calledn"; // Only for debug purposes,remove with all the //DEBUG thing

}



int main ()
{
combo = 0; //no initial knows combo
bool checkerboard[9];
for( int i=0; i<9; i++) checkerboard[i]=false; //blank initial pattern

research(0/*no point taken*/,checkerboard,-1/*just a useless value*/,0/*blank combo*/,1/*it's the firs iteration*/); //let's search!

cout << "n" ;
cout << "And the answer is ... " << combo << "n"; //out

char ans='';
while(ans=='')
{ //just waiting
cin >> ans;
}

return 0;
}





share|cite|improve this answer





















  • Please add more details, what are you trying to find here?
    – Petite Etincelle
    Aug 16 '14 at 8:42






  • 1




    This is a brute-force search and is a valid approach. However it does not show any mathematical way of approaching the answer. This should probably be CW.
    – Ali Caglayan
    Aug 16 '14 at 10:39













up vote
0
down vote










up vote
0
down vote









I think it's impossible to find it in a combinatory way, I used a recursive research to find it and it gave me the answer 487272. Under there is the c++ code. But a lot of sites posts a lesser answer, 389112. I'd like to see a more matematical way to solve this.



#include <iostream>
#include <stdlib.h>
using namespace std;

int combo; //counter

void research(int Ipoints /*number of points already took*/, bool Icheck[9]/*points matrix*/,int Ilast/*last took point*/,
int Icomboval/*combination representation, only for printing purpose*/, int deep/*number of iteration, only for printing purpose*/)
{

// int numcall = 0; //DEBUG


for( int i=0; i<9; i++) //Controlling every free point in search of a valid way to contimue
if( Icheck[i] == false )
{
//Just for security, coping every variable in a new variable. I don't know how c++ works but I will make it works
int points = Ipoints;
int last = Ilast;
int comboval = Icomboval;
bool check[9];
for( int j=0; j<9; j++)
check[j] = Icheck[j];

int e1,e2;
int middle = -1;
e1=i; e2=last; //Controlling duble jumps
if( e1 == 0 && e2 == 2 ) middle = 1;
if( e1 == 3 && e2 == 5 ) middle = 4;
if( e1 == 6 && e2 == 8 ) middle = 7;
if( e1 == 0 && e2 == 6 ) middle = 3;
if( e1 == 1 && e2 == 7 ) middle = 4;
if( e1 == 2 && e2 == 8 ) middle = 5;
if( e1 == 0 && e2 == 8 ) middle = 4;
if( e1 == 6 && e2 == 2 ) middle = 4;

e2=i; e1=last; // in both way
if( e1 == 0 && e2 == 2 ) middle = 1;
if( e1 == 3 && e2 == 5 ) middle = 4;
if( e1 == 6 && e2 == 8 ) middle = 7;
if( e1 == 0 && e2 == 6 ) middle = 3;
if( e1 == 1 && e2 == 7 ) middle = 4;
if( e1 == 2 && e2 == 8 ) middle = 5;
if( e1 == 0 && e2 == 8 ) middle = 4;
if( e1 == 6 && e2 == 2 ) middle = 4;

if((middle != -1) && !(check[middle])) {
check[middle] = true;
points++; //adding middle points
comboval *= 10;
comboval += middle;
}

check[i] = true;
points++; // get the point

comboval*=10;
comboval += i+1;

if(points > 3)
{
combo++; // every iteration over tree points is a valid combo

// If you want to see they all, beware because printing they all is truly slow:
// cout << "Combination n. " << combo << " found: " << comboval << " , points " << points << " with " << deep << " iterationsn";
}

if(points > 9) //Just for sure, emergency shutdown,
{ exit(1); }


research(points,check,i,comboval,deep+1); /*Recursive, here is the true program!*/

// numcall++; //DEBUG
}

// cout << "Ended " << deep << " , with " << numcall << " subs calledn"; // Only for debug purposes,remove with all the //DEBUG thing

}



int main ()
{
combo = 0; //no initial knows combo
bool checkerboard[9];
for( int i=0; i<9; i++) checkerboard[i]=false; //blank initial pattern

research(0/*no point taken*/,checkerboard,-1/*just a useless value*/,0/*blank combo*/,1/*it's the firs iteration*/); //let's search!

cout << "n" ;
cout << "And the answer is ... " << combo << "n"; //out

char ans='';
while(ans=='')
{ //just waiting
cin >> ans;
}

return 0;
}





share|cite|improve this answer












I think it's impossible to find it in a combinatory way, I used a recursive research to find it and it gave me the answer 487272. Under there is the c++ code. But a lot of sites posts a lesser answer, 389112. I'd like to see a more matematical way to solve this.



#include <iostream>
#include <stdlib.h>
using namespace std;

int combo; //counter

void research(int Ipoints /*number of points already took*/, bool Icheck[9]/*points matrix*/,int Ilast/*last took point*/,
int Icomboval/*combination representation, only for printing purpose*/, int deep/*number of iteration, only for printing purpose*/)
{

// int numcall = 0; //DEBUG


for( int i=0; i<9; i++) //Controlling every free point in search of a valid way to contimue
if( Icheck[i] == false )
{
//Just for security, coping every variable in a new variable. I don't know how c++ works but I will make it works
int points = Ipoints;
int last = Ilast;
int comboval = Icomboval;
bool check[9];
for( int j=0; j<9; j++)
check[j] = Icheck[j];

int e1,e2;
int middle = -1;
e1=i; e2=last; //Controlling duble jumps
if( e1 == 0 && e2 == 2 ) middle = 1;
if( e1 == 3 && e2 == 5 ) middle = 4;
if( e1 == 6 && e2 == 8 ) middle = 7;
if( e1 == 0 && e2 == 6 ) middle = 3;
if( e1 == 1 && e2 == 7 ) middle = 4;
if( e1 == 2 && e2 == 8 ) middle = 5;
if( e1 == 0 && e2 == 8 ) middle = 4;
if( e1 == 6 && e2 == 2 ) middle = 4;

e2=i; e1=last; // in both way
if( e1 == 0 && e2 == 2 ) middle = 1;
if( e1 == 3 && e2 == 5 ) middle = 4;
if( e1 == 6 && e2 == 8 ) middle = 7;
if( e1 == 0 && e2 == 6 ) middle = 3;
if( e1 == 1 && e2 == 7 ) middle = 4;
if( e1 == 2 && e2 == 8 ) middle = 5;
if( e1 == 0 && e2 == 8 ) middle = 4;
if( e1 == 6 && e2 == 2 ) middle = 4;

if((middle != -1) && !(check[middle])) {
check[middle] = true;
points++; //adding middle points
comboval *= 10;
comboval += middle;
}

check[i] = true;
points++; // get the point

comboval*=10;
comboval += i+1;

if(points > 3)
{
combo++; // every iteration over tree points is a valid combo

// If you want to see they all, beware because printing they all is truly slow:
// cout << "Combination n. " << combo << " found: " << comboval << " , points " << points << " with " << deep << " iterationsn";
}

if(points > 9) //Just for sure, emergency shutdown,
{ exit(1); }


research(points,check,i,comboval,deep+1); /*Recursive, here is the true program!*/

// numcall++; //DEBUG
}

// cout << "Ended " << deep << " , with " << numcall << " subs calledn"; // Only for debug purposes,remove with all the //DEBUG thing

}



int main ()
{
combo = 0; //no initial knows combo
bool checkerboard[9];
for( int i=0; i<9; i++) checkerboard[i]=false; //blank initial pattern

research(0/*no point taken*/,checkerboard,-1/*just a useless value*/,0/*blank combo*/,1/*it's the firs iteration*/); //let's search!

cout << "n" ;
cout << "And the answer is ... " << combo << "n"; //out

char ans='';
while(ans=='')
{ //just waiting
cin >> ans;
}

return 0;
}






share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered Aug 16 '14 at 7:25









Zannabianca1997

1




1












  • Please add more details, what are you trying to find here?
    – Petite Etincelle
    Aug 16 '14 at 8:42






  • 1




    This is a brute-force search and is a valid approach. However it does not show any mathematical way of approaching the answer. This should probably be CW.
    – Ali Caglayan
    Aug 16 '14 at 10:39


















  • Please add more details, what are you trying to find here?
    – Petite Etincelle
    Aug 16 '14 at 8:42






  • 1




    This is a brute-force search and is a valid approach. However it does not show any mathematical way of approaching the answer. This should probably be CW.
    – Ali Caglayan
    Aug 16 '14 at 10:39
















Please add more details, what are you trying to find here?
– Petite Etincelle
Aug 16 '14 at 8:42




Please add more details, what are you trying to find here?
– Petite Etincelle
Aug 16 '14 at 8:42




1




1




This is a brute-force search and is a valid approach. However it does not show any mathematical way of approaching the answer. This should probably be CW.
– Ali Caglayan
Aug 16 '14 at 10:39




This is a brute-force search and is a valid approach. However it does not show any mathematical way of approaching the answer. This should probably be CW.
– Ali Caglayan
Aug 16 '14 at 10:39










up vote
-2
down vote













I try with combinatorics addition and multiplication principle. I just share my try. if there is any improvement, please suggest.enter image description here






share|cite|improve this answer





















  • Your solution does not implement the requirement of no jumps. For example starting from button 1 you cant go straight to 3,6,7,8,9, but only to 2,4 and 5.
    – Jaroslaw Matlak
    Oct 19 at 12:33















up vote
-2
down vote













I try with combinatorics addition and multiplication principle. I just share my try. if there is any improvement, please suggest.enter image description here






share|cite|improve this answer





















  • Your solution does not implement the requirement of no jumps. For example starting from button 1 you cant go straight to 3,6,7,8,9, but only to 2,4 and 5.
    – Jaroslaw Matlak
    Oct 19 at 12:33













up vote
-2
down vote










up vote
-2
down vote









I try with combinatorics addition and multiplication principle. I just share my try. if there is any improvement, please suggest.enter image description here






share|cite|improve this answer












I try with combinatorics addition and multiplication principle. I just share my try. if there is any improvement, please suggest.enter image description here







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered Aug 13 at 16:22









Prabhakaran

937




937












  • Your solution does not implement the requirement of no jumps. For example starting from button 1 you cant go straight to 3,6,7,8,9, but only to 2,4 and 5.
    – Jaroslaw Matlak
    Oct 19 at 12:33


















  • Your solution does not implement the requirement of no jumps. For example starting from button 1 you cant go straight to 3,6,7,8,9, but only to 2,4 and 5.
    – Jaroslaw Matlak
    Oct 19 at 12:33
















Your solution does not implement the requirement of no jumps. For example starting from button 1 you cant go straight to 3,6,7,8,9, but only to 2,4 and 5.
– Jaroslaw Matlak
Oct 19 at 12:33




Your solution does not implement the requirement of no jumps. For example starting from button 1 you cant go straight to 3,6,7,8,9, but only to 2,4 and 5.
– Jaroslaw Matlak
Oct 19 at 12:33


















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f634437%2fhow-many-combinations-does-android-pattern-have%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Index of /

Tribalistas

Listed building