Popular recipes tagged "number" but not "card"http://code.activestate.com/recipes/tags/number-card/2013-01-31T23:41:21-08:00ActiveState Code RecipesSpoken Word to Number (Python)
2012-09-11T18:42:09-07:00Pushpendrehttp://code.activestate.com/recipes/users/4183526/http://code.activestate.com/recipes/578258-spoken-word-to-number/
<p style="color: grey">
Python
recipe 578258
by <a href="/recipes/users/4183526/">Pushpendre</a>
(<a href="/recipes/tags/converter/">converter</a>, <a href="/recipes/tags/nlp/">nlp</a>, <a href="/recipes/tags/number/">number</a>, <a href="/recipes/tags/spoken/">spoken</a>).
</p>
<p>convert number represented the way they are spoken to actual numbers</p>
Random Number Game (C)
2012-03-29T03:47:52-07:00Jacob A. Bridgeshttp://code.activestate.com/recipes/users/4181498/http://code.activestate.com/recipes/578088-random-number-game/
<p style="color: grey">
C
recipe 578088
by <a href="/recipes/users/4181498/">Jacob A. Bridges</a>
(<a href="/recipes/tags/c/">c</a>, <a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/guessing/">guessing</a>, <a href="/recipes/tags/number/">number</a>).
</p>
<p>An old game I created freshman year of college. For use on Windows OS only. (The code contains a few Windows system calls.)</p>
Evolutionary Algorithm (Generation of Prime Numbers) (Python)
2011-11-27T06:45:00-08:00Alexander James Wallarhttp://code.activestate.com/recipes/users/4179768/http://code.activestate.com/recipes/577964-evolutionary-algorithm-generation-of-prime-numbers/
<p style="color: grey">
Python
recipe 577964
by <a href="/recipes/users/4179768/">Alexander James Wallar</a>
(<a href="/recipes/tags/algorithm/">algorithm</a>, <a href="/recipes/tags/example/">example</a>, <a href="/recipes/tags/genetic/">genetic</a>, <a href="/recipes/tags/genetic_algorithm/">genetic_algorithm</a>, <a href="/recipes/tags/genetic_algorithms/">genetic_algorithms</a>, <a href="/recipes/tags/list/">list</a>, <a href="/recipes/tags/number/">number</a>, <a href="/recipes/tags/of/">of</a>, <a href="/recipes/tags/prime/">prime</a>, <a href="/recipes/tags/primelist/">primelist</a>, <a href="/recipes/tags/primes/">primes</a>, <a href="/recipes/tags/theory/">theory</a>).
</p>
<p>This is an evolutionary algorithm that returns a random list of prime numbers. This code is highly inefficient for a reason. This algorithm is more of a proof of concept that if a prime was a heritable trait, it would not be a desired one. </p>
<p>Parameters:</p>
<p>isPrime --> n: number to check if it is prime
allPrimes --> n: size of list of random primes, m: the primes in the list will be between 0 and m</p>
Long period random number generator (Python)
2010-12-02T05:19:25-08:00Raymond Hettingerhttp://code.activestate.com/recipes/users/178123/http://code.activestate.com/recipes/576707-long-period-random-number-generator/
<p style="color: grey">
Python
recipe 576707
by <a href="/recipes/users/178123/">Raymond Hettinger</a>
(<a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/number/">number</a>, <a href="/recipes/tags/random/">random</a>).
Revision 13.
</p>
<p>Implements a complementary-multiply-with-carry psuedo-random-number-generator. Period is 3636507990 * 2 ** 43487 (approximately 10 ** 13101).</p>
Fibonacci Number Generator (Python)
2011-04-13T00:00:59-07:00Sunjay Varmahttp://code.activestate.com/recipes/users/4174115/http://code.activestate.com/recipes/577651-fibonacci-number-generator/
<p style="color: grey">
Python
recipe 577651
by <a href="/recipes/users/4174115/">Sunjay Varma</a>
(<a href="/recipes/tags/fibonacci/">fibonacci</a>, <a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/memorizing/">memorizing</a>, <a href="/recipes/tags/number/">number</a>).
</p>
<p>This recipe allows for individual number generation, and allows for generations of number ranges as well. </p>
<p>The recipe automatically memorizes numbers generated before and keeps them through out the running of the script. This recipe cannot handle too large of numbers, but does act as a simple solution for most cases.</p>
Chek if a number is a power of two (Python)
2010-12-23T11:29:38-08:00A. Polinohttp://code.activestate.com/recipes/users/4176317/http://code.activestate.com/recipes/577514-chek-if-a-number-is-a-power-of-two/
<p style="color: grey">
Python
recipe 577514
by <a href="/recipes/users/4176317/">A. Polino</a>
(<a href="/recipes/tags/2/">2</a>, <a href="/recipes/tags/check/">check</a>, <a href="/recipes/tags/number/">number</a>, <a href="/recipes/tags/power/">power</a>, <a href="/recipes/tags/python/">python</a>).
Revision 2.
</p>
<p>Pretty good way to check if a number is a power of two or not.</p>
Number To Words Converter (100 => One Hundred) (Java)
2010-07-18T11:17:52-07:00st0lehttp://code.activestate.com/recipes/users/4174421/http://code.activestate.com/recipes/577312-number-to-words-converter-100-one-hundred/
<p style="color: grey">
Java
recipe 577312
by <a href="/recipes/users/4174421/">st0le</a>
(<a href="/recipes/tags/conversions/">conversions</a>, <a href="/recipes/tags/integer/">integer</a>, <a href="/recipes/tags/java/">java</a>, <a href="/recipes/tags/number/">number</a>).
</p>
<p>Converts Integers to Words.</p>
format a number as an ordinal (Python)
2010-02-04T12:54:27-08:00Serdar Tumgorenhttp://code.activestate.com/recipes/users/4171495/http://code.activestate.com/recipes/576888-format-a-number-as-an-ordinal/
<p style="color: grey">
Python
recipe 576888
by <a href="/recipes/users/4171495/">Serdar Tumgoren</a>
(<a href="/recipes/tags/number/">number</a>, <a href="/recipes/tags/numbers/">numbers</a>, <a href="/recipes/tags/numerals/">numerals</a>, <a href="/recipes/tags/ordinals/">ordinals</a>).
Revision 10.
</p>
<p>This function converts 0 and <em>positive</em> integers (or their string representations) to their ordinal values. For example, it would convert 0 to "0th", 1 to "1st", 2 to "2nd", 3 to "3rd" and so on.</p>
Invert the well ids from a 96-well plate (Python)
2009-09-04T02:36:01-07:00Kevinhttp://code.activestate.com/recipes/users/4171628/http://code.activestate.com/recipes/576895-invert-the-well-ids-from-a-96-well-plate/
<p style="color: grey">
Python
recipe 576895
by <a href="/recipes/users/4171628/">Kevin</a>
(<a href="/recipes/tags/96/">96</a>, <a href="/recipes/tags/biology/">biology</a>, <a href="/recipes/tags/id/">id</a>, <a href="/recipes/tags/invert/">invert</a>, <a href="/recipes/tags/number/">number</a>, <a href="/recipes/tags/sequencing/">sequencing</a>, <a href="/recipes/tags/well/">well</a>).
Revision 2.
</p>
<p>Due to a mixup in processing, I require to invert the order of the well numbers from a 96-well plate</p>
Inverse modulo p (Python)
2013-01-31T23:41:21-08:00Justin Shawhttp://code.activestate.com/recipes/users/1523109/http://code.activestate.com/recipes/576737-inverse-modulo-p/
<p style="color: grey">
Python
recipe 576737
by <a href="/recipes/users/1523109/">Justin Shaw</a>
(<a href="/recipes/tags/mod/">mod</a>, <a href="/recipes/tags/modulo/">modulo</a>, <a href="/recipes/tags/number/">number</a>, <a href="/recipes/tags/prime/">prime</a>, <a href="/recipes/tags/theory/">theory</a>).
Revision 4.
</p>
<p>Very rarely it is necessary to find the multiplicative inverse of a number in the ring of integers modulo p. Thie recipe handles those rare cases. That is, given x, an integer, and p the modulus, we seek a integer x^-1 such that x * x^-1 = 1 mod p. For example 38 is the inverse of 8 modulo 101 since 38 * 8 = 304 = 1 mod 101. The inverse only exists when a and p are relatively prime.</p>
Prime Number Generator (Python)
2009-02-03T15:47:06-08:00dthhttp://code.activestate.com/recipes/users/4169078/http://code.activestate.com/recipes/576640-prime-number-generator/
<p style="color: grey">
Python
recipe 576640
by <a href="/recipes/users/4169078/">dth</a>
(<a href="/recipes/tags/eratosthene/">eratosthene</a>, <a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/number/">number</a>, <a href="/recipes/tags/of/">of</a>, <a href="/recipes/tags/prime/">prime</a>, <a href="/recipes/tags/sieve/">sieve</a>).
Revision 7.
</p>
<p>Generate all prime numbers up to n.</p>
Class to calculate increment of variables based on time (units per seconds) (Python)
2008-08-18T16:29:08-07:00nosklohttp://code.activestate.com/recipes/users/4166478/http://code.activestate.com/recipes/576424-class-to-calculate-increment-of-variables-based-on/
<p style="color: grey">
Python
recipe 576424
by <a href="/recipes/users/4166478/">nosklo</a>
(<a href="/recipes/tags/increment/">increment</a>, <a href="/recipes/tags/linear/">linear</a>, <a href="/recipes/tags/number/">number</a>, <a href="/recipes/tags/time/">time</a>, <a href="/recipes/tags/units_per_second/">units_per_second</a>, <a href="/recipes/tags/variables/">variables</a>).
Revision 3.
</p>
<p>A simple calculation of small increments to be applied to a variable, given the variable time that has passed since last update, to make a linear increase over time (in units per second).</p>