From Math To Machine
In this post I'm going to explore how a mathematical concept can be redefined in progressively more computer-oriented terms, all the way from high level languages down to machine code, ready for direct execution by a computer. To that end, I'm going to define the same logic in several different but related formats: If you're interested in how language styles can differ or curious about what your code might look like after being compiled, keep reading! A factorial is the product of an integer and all smaller integers greater than 0. There are lots of ways to describe a definition like this. This definition states that n! is the product of all integers from 1 to n. One important use of factorials is calculating the total number of permutations of a set. For example, the string "cat" can be rearranged in 6 possible ways: "cat", "act", "atc", "tac", "tca", and "cta". This string has 3 letters and 3! 6. The string "a", which has one character, can only be arranged in that one way.
Feb-26-2017, 11:15:28 GMT
- Technology: