Popular recipes tagged "number" but not "prime"http://code.activestate.com/recipes/tags/number-prime/2012-09-11T18:42:09-07: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>
Credit Card Validation (Python)
2011-08-11T19:06:58-07:00Stijn de Graafhttp://code.activestate.com/recipes/users/4178055/http://code.activestate.com/recipes/577838-credit-card-validation/
<p style="color: grey">
Python
recipe 577838
by <a href="/recipes/users/4178055/">Stijn de Graaf</a>
(<a href="/recipes/tags/card/">card</a>, <a href="/recipes/tags/credit/">credit</a>, <a href="/recipes/tags/false/">false</a>, <a href="/recipes/tags/number/">number</a>, <a href="/recipes/tags/testing/">testing</a>, <a href="/recipes/tags/true/">true</a>, <a href="/recipes/tags/validating/">validating</a>, <a href="/recipes/tags/validation/">validation</a>).
</p>
<p>Test validity of any credit card number using the LUHN method (mod 10).
Starting at the last digit and moving backwards, you add up every other digit.
Then, you double the left-out digits, and add the digits of these results to the original sum.
If this satisfies sum mod 10 == 0 then the card is valid.</p>
<p>This is also explained at <a href="http://www.beachnet.com/%7Ehstiles/cardtype.html" rel="nofollow">http://www.beachnet.com/~hstiles/cardtype.html</a></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>
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>