CopyPastor

Detecting plagiarism made easy.

Score: -1; Reported for: Open both answers

Possible Plagiarism

Plagiarized on 2018-02-08
by chrisz

Original Post

Original - Posted on 2010-02-15
by jellyfishtree



            
Present in both answers; Present only in the new answer; Present only in the old answer;

If you want to convert a number from Base 10 to Base 3, you can use the following, found [here](https://stackoverflow.com/a/2267428/3483203):
def baseN(num,b,numerals="0123456789abcdefghijklmnopqrstuvwxyz"): return ((num == 0) and numerals[0]) or (baseN(num // b, b, numerals).lstrip(numerals[0]) + numerals[num % b]) print(baseN(32, 3))
Output:
1012
<!-- language: python -->
def baseN(num,b,numerals="0123456789abcdefghijklmnopqrstuvwxyz"): return ((num == 0) and numerals[0]) or (baseN(num // b, b, numerals).lstrip(numerals[0]) + numerals[num % b])
ref: [http://code.activestate.com/recipes/65212/][1]



[1]: http://code.activestate.com/recipes/65212/
Please be aware that this may lead to
RuntimeError: maximum recursion depth exceeded in cmp
for very big integers.

        
Present in both answers; Present only in the new answer; Present only in the old answer;