Yes. A. Numbers implementation,math
-Average of the total number of digits to write from binary to A-1? ??
・ Generate an n-ary expression.
・ 5 is expressed from binary to quaternary. · Binary: 101 ternary: 12 quaternary: 11 The sum of each digit is 2,3,2
a.py
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import time
import sys, io
import re, math
start = time.clock()
a=int(raw_input())
s=0
for n in range(2,a):
c=a
#Add the remainder to s.(I want to know the sum, so I don't need to save the order)
#c continues to substitute the quotient.
while c:s+=c%n;c/=n
x,y=s,a-2
while y:x,y=y,x%y
print str(s/x) +'/'+ str((a-2)/x)
How to convert a number given in decimal to n It is like this.
Recommended Posts