My Math Forum How find all number sequences where the difference between adjacent numbers >= k
 User Name Remember Me? Password

 Number Theory Number Theory Math Forum

 May 3rd, 2017, 11:36 AM #11 Math Team   Joined: Oct 2011 From: Ottawa Ontario, Canada Posts: 11,324 Thanks: 728 Sorry...no idea what you're talking about; perhaps someone else here will jump in...
 May 3rd, 2017, 03:56 PM #12 Newbie   Joined: Sep 2014 From: Kiev Posts: 10 Thanks: 0 I meant what iterative approach can be used? Could my option be applied that is without permutation approach?
May 3rd, 2017, 04:38 PM   #13
Senior Member

Joined: Jun 2014
From: USA

Posts: 320
Thanks: 23

Quote:
 Originally Posted by stt I meant what iterative approach can be used? Could my option be applied that is without permutation approach?
When I suggested the permutation approach, I had misunderstood what you were asking. I didn't think {1,3,1,3,1} could be a solution, noting it isn't a permutation of {1,2,3,4,5}.

To find all of the possibilities for your actual question, you need to iterate through $n^n$ sets as opposed to $n!$ permutations. When $n$ is large enough, that's a lot of iterations.

I don't see this as being that complex of a problem to program, but you'd need a very fast computer with an awful lot of memory...

So, you can make your array, or iterate if you prefer, through $n^n$ different sets in order to find all of the ones that suffice for any given value of $k$. The value of $k$ has no impact on the number of iterations if you intend to go through all of them, noting that as $k$ gets larger, the number of sets meeting the criteria gets smaller.

Why $n^n$ iterations, you might ask? Let's consider $n = 3$ implying you are working with the set {1, 2, 3}. You'll then have $3^3 = 27$ possibilities:

{1, 1, 1}, {2, 1, 1}, {3, 1, 1}
{1, 1, 2}, {2, 1, 2}, {3, 1, 2}
{1, 1, 3}, {2, 1, 3}, {3, 1, 3}
{1, 2, 1}, {2, 2, 1}, {3, 2, 1}
{1, 2, 2}, {2, 2, 2}, {3, 2, 2}
{1, 2, 3}, {2, 2, 3}, {3, 2, 3}
{1, 3, 1}, {2, 3, 1}, {3, 3, 1}
{1, 3, 2}, {2, 3, 2}, {3, 3, 2}
{1, 3, 3}, {2, 3, 3}, {3, 3, 3}

Iterate through all of them displaying the ones that meet the criteria for your given value of $k$ and you're done. You should see how easy it would be to construct a FOR loop for this, hopefully.

Assuming you want a better answer, one that means you don't go through all the possible iterations, then good luck. Perhaps you'll be able to solve the P = NP problem in the process...

Last edited by AplanisTophet; May 3rd, 2017 at 04:55 PM.

 May 4th, 2017, 02:43 AM #14 Newbie   Joined: Sep 2014 From: Kiev Posts: 10 Thanks: 0 I do understand that I need to use all n^n (even not n^k as in probability handbooks). So maybe such permutation approach is not appropriate. As then there were several task and "n" provisioned to be at such level of as 10^6 or so, I already do not remember so that case. And as I reviewed some permutation examples even bogomolsky recursion examples lead to duplicates, but what to talk about when there are extremely huge variations when n is relative high. So I even cannot find some raw or valid example for n^n permutations.
 May 9th, 2017, 08:09 AM #15 Newbie   Joined: Sep 2014 From: Kiev Posts: 10 Thanks: 0 I have some unrelating question but I would grateful for answer. In testing when test has 5-6 options for answer and you can choose more than one (2,3,4) how answer would be rated if you choose not all correct answers. For example 2-instead 3, 2 instead 4, 3 instead 4. Should the answer get 0 mark or it would get proportionally to number of correct answers or so? I mean the testing in programming/algorithms?
 May 9th, 2017, 09:29 AM #16 Math Team   Joined: Oct 2011 From: Ottawa Ontario, Canada Posts: 11,324 Thanks: 728 Well, I don't understand what you're asking... may I suggest you find someone who knows English well, to help you write out your problem. Iterations are simple, being "loops". BUT if you need to do 100 of them, still simple BUT enormous time required.

 Tags >, adjacent, difference, find, number, numbers, sequences

,

### Училка в своем разговоре намекает на секс

Click on a term to search for related topics.
 Thread Tools Display Modes Linear Mode

 Similar Threads Thread Thread Starter Forum Replies Last Post DaphneV Probability and Statistics 2 December 11th, 2016 08:08 PM r-soy Probability and Statistics 3 October 14th, 2013 01:50 AM aprilautumn1234 Algebra 2 August 18th, 2013 09:32 PM sharp Elementary Math 7 October 30th, 2010 09:52 AM aprilautumn1234 Calculus 1 December 31st, 1969 04:00 PM

 Contact - Home - Forums - Cryptocurrency Forum - Top