Popular recipes tagged "integers" but not "python"http://code.activestate.com/recipes/tags/integers-python/2017-03-12T23:10:48-07:00ActiveState Code RecipesNumber of bits needed to store an integer, and its binary representation (Python) 2017-03-12T23:10:48-07:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580762-number-of-bits-needed-to-store-an-integer-and-its-/ <p style="color: grey"> Python recipe 580762 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/binary/">binary</a>, <a href="/recipes/tags/formats/">formats</a>, <a href="/recipes/tags/integers/">integers</a>, <a href="/recipes/tags/numbers/">numbers</a>, <a href="/recipes/tags/representation/">representation</a>, <a href="/recipes/tags/type/">type</a>). </p> <p>This recipe shows how to find, via Python code, the number of bits needed to store an integer, and how to generate its binary representation. It does this for integers from 0 to 256.</p> <p>More details and full output here:</p> <p><a href="https://jugad2.blogspot.in/2017/03/find-number-of-bits-needed-to-store.html" rel="nofollow">https://jugad2.blogspot.in/2017/03/find-number-of-bits-needed-to-store.html</a></p> Karatsuba algorithm (C++) 2009-07-02T14:23:17-07:00Guillermo Lópezhttp://code.activestate.com/recipes/users/4170956/http://code.activestate.com/recipes/576827-karatsuba-algorithm/ <p style="color: grey"> C++ recipe 576827 by <a href="/recipes/users/4170956/">Guillermo López</a> (<a href="/recipes/tags/integers/">integers</a>, <a href="/recipes/tags/karatsuba/">karatsuba</a>, <a href="/recipes/tags/multiply/">multiply</a>). </p> <p>Used to multiply big integers (visible difference with &gt;400bits).</p> Converting arbitrary size Python integers to packed binary data strings (Python) 2009-01-16T13:27:29-08:00David Mosshttp://code.activestate.com/recipes/users/4124829/http://code.activestate.com/recipes/576617-converting-arbitrary-size-python-integers-to-packe/ <p style="color: grey"> Python recipe 576617 by <a href="/recipes/users/4124829/">David Moss</a> (<a href="/recipes/tags/binary/">binary</a>, <a href="/recipes/tags/integers/">integers</a>, <a href="/recipes/tags/pack/">pack</a>, <a href="/recipes/tags/struct/">struct</a>, <a href="/recipes/tags/unpack/">unpack</a>, <a href="/recipes/tags/unsigned/">unsigned</a>). </p> <p>Routines for converting <strong>large</strong> unsigned arbitrary sized Python integers to packed binary data strings and vice versa.</p>