[sage-support] Re: How to write array in sage?

2016-06-13 Thread slelievre
2016-06-12 09:13:00 UTC+2, Sayantan Koley: I'm writing square and multiply algorithm. > but i need to store binary digits in sage. > how to do? > Here is a way to get the binary digits of an integer. sage: a = 41 sage: a.bits() [1, 0, 0, 1, 0, 1] You can also have a look at the

[sage-support] Re: How to write array in sage?

2016-06-12 Thread Dominique Laurain
Hello, Your question is "basic" but confusing about the result you want from your code. "Binary digits" (=bits) are stored everywhere in code data : characters, integers, floating and so on. My advice : use numpy (and learn more and more about it). Read this first :