1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Simple factorial and matrix question

  1. Apr 29, 2012 #1
    if I have n slots [1,2,3,4,5,...n] where I must use numbers from 1 through n, and I have to ensure that none of them were reused...

    the way I figure to make sure that none of the numbers are reused is to multiply the values in each slot and compare them against n!

    e.g. [1,2,3,4,5] would be correct, but [1,4,6,3,2] or [5,5,2,1,3]

    kind of like sudoku's rule for a row but not quite
    e.g. if I had n=6
    [[1,2,3,4,5,6],
    [6,1,2,3,4,5],
    [5,6,1,2,3,4],
    [4,5,6,1,2,3],
    [3,4,5,6,1,2]]
    that would be correct

    Am I right in assuming that that n! would be useful for looping through the rows to see if they are correct? and then (n!)^(n) would be a way to validate the entire grid?

    is this a rule I just don't know? is there a rule that is easier?
     
    Last edited: Apr 29, 2012
  2. jcsd
  3. Apr 29, 2012 #2


    Google "permutations", and yes: there are n! different ways to order in an array the numbers 1,2,...,n in such a way that each

    appears exactly once.

    DonAntonio
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Simple factorial and matrix question
  1. Factorial Question (Replies: 2)

  2. Factorial Question (Replies: 1)

  3. Simple matrix question (Replies: 2)

Loading...