Thank you. Is there any function in Python for inverse modulo of an integer? Corresponding Sage function is A=15.inverse_mod(17). Also is there any function like ''.join(str(i) for i in A) in Python for an array A?
On 17 September 2011 19:36, D. S. McNeil <[email protected]> wrote: > > It always returns 101, not a random prime of 100 bit integer. > > That's because in Python/Cython, the carat ^ isn't exponentiation, > it's bitwise xor. The most general solution is to use **: > > Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) > [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> 2^(100-1) > 97 > >>> 2^(100) > 102 > >>> 2**(100-1) > 633825300114114700748351602688L > >>> 2**(100) > 1267650600228229401496703205376L > > > Doug > > -- > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/sage-support > URL: http://www.sagemath.org > -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
