Problem:
 Score : 300 points    Problem Statement You are given an integer N . For two positive integers A and B , we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A , and the number of digits in the decimal notation of B . For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B .      Constraints  1 \leq N \leq 10^{10}  N is an integer.         Input The input is given from Standard Input in the following format:  N       Output Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B .        Sample Input 1 10000      Sample Output 1 3  F(A,B) has a minimum value of 3 at (A,B)=(100,100) .       Sample Input 2 1000003      Sample Output 2 7  There are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1) . For these pairs, F(1,1000003)=F(1000003,1)=7 .       Sample Input 3 9876543210      Sample Output 3 6

Solution (Python):


import math

N = int(input())
ans = 1e10
for i in range(1, int(math.sqrt(N)) + 1):
    j = N // i
    if N == i * j:
        ans = min(ans, max(len(str(i)), len(str(N // i))))
print(ans)

Solution (Python):
import math


def f(a, b):
    q = len(str(a))
    w = len(str(b))
    return max(q, w)


N = int(input())
mi = 10**10
for i in range(1, int(math.sqrt(N)) + 1):
    if N % i == 0:
        mi = min(mi, f(i, int(N/i)))
print(mi)

Solution (Python):
import math

N = input()

a=[]

for i in range(1, int(math.sqrt(N)+1)):
    if(N%i==0):
        a.append(i)

b=[]

for i in a:
    x=int(math.log10(i) + 1)
    y=int(math.log10(N/i) + 1)
    b.append(max([x,y]))

print min(b)

Solution (Python):
import itertools

n = int(input())
factor = []
div = 2
while n >= div*div:
    if n % div == 0:
        factor.append(max(div,n//div))
    div += 1
factor.append(int(n))
print(len(str(min(factor))))

Solution (Python):
import sys
import math

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func()
    top_str = input_raw.strip().split()
    [N] = [int(top_str[0])]

    min_F = sys.maxint
    digit = int(math.log10(N) + 1)
    for i in range(10 ** int((digit)/2.0 + 0.5) , 0 , -1):
        if(N % i == 0):
            A = i
            B = N/i
            F = max(int(math.log10(A) + 1), int(math.log10(B) + 1))
            if F < min_F:
                min_F = F
            
    print min_F



if __name__ == '__main__':
    main()

Solution (Python):
import math

n=int(input())

def keta(n):
    return int(math.log10(n)+1)
def max(a,b):
    if a>b :return a
    else: return b

result=100
for i in range(1,math.ceil(math.sqrt(n)+3)):
    if n%i==0 and result>max(keta(i),keta(n//i)):
        result=max(keta(i),keta(n//i))
print(result)

Solution (Python):
n = int(input())

def prime_decomposition(n):
    
    if n < 2:
        return []
    prime_factors = []
    while n % 2 == 0:
        prime_factors.append(2)
        n >>= 1

    while n % 3 == 0:
        prime_factors.append(3)
        n //= 3

    a = 5
    b = 7
    while a ** 2 <= n:
        if n % a == 0:
            prime_factors.append(a)
            n //= a
        elif n % b == 0:
            prime_factors.append(b)
            n //= b
        else:
            a += 6
            b += 6
    if n > 1:
        prime_factors.append(n)
    return prime_factors

pfs = prime_decomposition(n)
pfs.reverse()

def ds(n):

    ret = 1
    while 10**ret <= n:
        ret += 1
    return ret

ln = len(pfs)
size = 2**ln

min_v = 100
for i in range(size):
    p = 1
    for j in range(ln):
        if 1<<j & i:
            p *= pfs[j]
    min_v = min(min_v, max(ds(p), ds(n//p)))
print(min_v)

Solution (Python):
import math
n=int(input())
m=int(math.sqrt(n))
i=0
while 1:
 if n%(m-i)==0 and n%(m+i+1)==0:
  print(min(int(math.log10(n/(m-i))),int(math.log10(m+i+1)))+1)
  break
 if n%(m-i)==0:
  print(int(math.log10(n/(m-i)))+1)
  break
 if n%(m+1+i)==0:
  print(int(math.log10(m+i+1))+1)
  break
 i+=1

Solution (Python):
from math import sqrt

def numLen(num):
  return len(str(abs(num)))

def F(a, b):
    return max(numLen(a), numLen(b))

N = int(input())
sqrtN = int(sqrt(N))

p = (0, 0)
for i in range(1,sqrtN+1):
    if N % i == 0 and p[0] < i:
        p = (i, N//i)

print(F(p[0], p[1]))

Solution (Python):

import math

N = int(input())
r = math.sqrt(N)
R = int(r)
if r == R:
    print(len(str(R)))
    quit()
for i in range(R + 1, 3, -1):
    if N % i == 0:
        b = int(N / i)
        if len(str(i)) >= len(str(b)):
            print (len(str(i)))
        else:
            print (len(str(b)))
        quit()
print(len(str(N)))

Solution (Python):
import math

N=int(raw_input())

n=math.floor(math.sqrt(N))

while(N%n!=0): n-=1

m=N/n
n=int(n)
m=int(m)

if n>=m:
    print len(str(n))
else:
    print len(str(m))

Solution (Python):
import math

n=int(input())

res=float('inf')
for i in range(1,int(math.sqrt(n))+10):
    if n%i==0:
        res=min(res,max(len(str(i)),len(str(n//i))))
print(res)

Solution (Python):
import math

N = int(input())

for i in range(1, math.ceil(math.sqrt(N)) + 1):
    if N % i == 0:
        factor1 = N / i
        factor2 = i

factor1 = int(factor1)

if factor1 < factor2:
    print(len(str(factor2)))
else:
    print(len(str(factor1)))

Solution (Python):
import itertools
def f(a, b):
    return max(len(str(a)), len(str(b)))
def p(n):
    l = []
    a, b = 0, 2
    while b * b <= n:
        if n % b == 0:
            n //= b
            l += [b]
        else:
            b += 1 + a
            a = 1
    if n > 1 : l += [n]
    return l

def main():
    N = int(input())
    l = p(N)
    if len(l) < 2:
        print(f(N, 1))
    else:
        w = len(l)
        ans = len(str(N))
        for i in itertools.product([0, 1], repeat=w):
            a = b = 1
            for j in range(w):
                if i[j] == 0:
                    a *= l[j]
                else:
                    b *= l[j]
            ans = min(ans, f(a, b))
        print(ans)
if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
A = []
i = 1
n = N ** (1/2)
while i <= n:
	if round((N / i) % 1,6) == 0:
		A.append(i)
	i = i + 1
a = max(len(str(A[-1])),len(str(N // A[-1])))
print(a)

Solution (Python):
import math

n=int(input())

res=float('inf')
for i in range(1,int(math.sqrt(n))+10):
    if n%i==0:
        res=min(res,max(len(str(i)),len(str(n//i))))
print(res)

Solution (Python):



import os
import sys
import itertools
import math
from collections import Counter, defaultdict

class Main(object):
    
    def __init__(self):
        pass

    def solve(self):
        '''
        insert your code
        '''
        n = int(input())
        candidate = int(math.sqrt(float(n)))

        for i in range(candidate, 0, -1):
            if n % i == 0:
                print(max(int(math.log10(i)) + 1, int(math.log10(n / i)) + 1))
                break
        return None

if __name__ == '__main__':
    m = Main()
    m.solve()

Solution (Python):
import sys
import math

INF = 10**9+7

stdin = sys.stdin
def na(): return map(int, stdin.readline().split())
def ns(): return stdin.readline().strip()
def nsl(): return list(stdin.readline().strip())
def ni(): return int(stdin.readline())
def nil(): return list(map(int, stdin.readline().split()))

a = b = INF
n = ni()

x = int(math.sqrt(n) // 1 + 1)
for i in reversed(range(x)):
    if((n/i) == (n//i)):
        a = i
        b = n // i
        break

ans = max(len(str(a)), len(str(b)))
print(ans)

Solution (Python):

import sys, math

ifnt = 168430090

def lg(x):
	bwl = 0
	while x > 0:
		x /= 10
		bwl = bwl + 1
	
	return bwl



n = input()
ans = ifnt
for i in range(int(math.sqrt(n))):
	if n % (i + 1) == 0:
		ans = min(ans, max(lg(i + 1), lg(n / (i + 1))))
	
print ans

Solution (Python):
import math

n = int(input())
m = int(math.sqrt(n))



if n % m == 0:
    print(int(math.log10(m) + 1))

else:
    for i in range(1, m)[::-1]:
        if n % (i) == 0:
            print(int(math.log10(n / i) + 1))
            break

Solution (Python):
import math
def digit(X):
    d = 0
    while X:
        X //= 10
        d += 1
    return d

def F(A, B):
    return max(digit(A), digit(B))

N = int(input())

min_F = 20
max_div = round(math.sqrt(N)) + 10
for i in range(1, max_div):
    if N % i == 0:
        f = F(i, N/i)
        if f < min_F:
            min_F = f
print(min_F)

Solution (Python):



def div_pairs(n):
    for i in range(1, n + 1):
        if i * i > n:
            break
        d, m = divmod(n, i)
        if m == 0:
            yield (i, d)


def f(a, b):
    return max(len(str(a)), len(str(b)))


def solve(n):
    return min(f(a, b) for a, b in div_pairs(n))


def main():
    print(solve(int(input())))


if __name__ == '__main__':
    main()

Solution (Python):
def f(a, b):
    return max(len(str(a)), len(str(b)))


def main():
    N = int(input())
    min_f = 10
    for i in range(1, N + 1):
        if i ** 2 > N:
            break
        if N % i != 0:
            continue
        f_v = f(i, N // i)
        if f_v < min_f:
            min_f = f_v
    print(min_f)

if __name__ == '__main__':
    main()

Solution (Python):


import math
import sys

def F(a, b):
    return max(len(str(a)), len(str(b)))

def main(argv):
    for line in sys.stdin:
        n = int(line)

        small= 0
        for i in xrange(int(math.sqrt(n)), 0, -1):
            if n % i == 0:
                small = i
                break

        print F(small, n / small)

if __name__ == "__main__":
    main(sys.argv)

Solution (Python):
import itertools,math,bisect,pprint,sys

n = input()
res = 10**5
for i in range(1,int(math.sqrt(n)+1)):
    a = i
    if n%i==0:
        b = n/a
        res = min(res,max(len(str(a)),len(str(b))))
print res

Solution (Python):
import math

if __name__ == '__main__':
    n = int(input())
    ans = float('inf')

    a = 1
    while a <= math.sqrt(n):
        if n % a == 0:
            b = n // a
            f = max(math.floor(math.log10(a) + 1), math.floor(math.log10(b) + 1))
            ans = min(f, ans)

        a += 1

    print(ans)

Solution (Python):
import math
n=int(raw_input())
sq=math.sqrt(n)
ans=None



if str(sq)[-2]=='.':
    print len(str(sq))-2
else:
    nu=[]
    while sq>1:
        sq=int(sq)
        if n%sq==0:
            nu.append(str(sq))
            nu.append(str(n/sq))
            sq-=1
            break
        else:
            sq-=1
    if len(nu)!=0:
        nu.sort(key=len)
        print len((nu[1]))
    else:
        print len(str(n))

Solution (Python):
n = int(input())
n_sqrt = int(n ** 0.5) + 1

max_len = 0
for a in range(1, n_sqrt + 1):
    if n % a == 0:
        b = str(n//a)
        max_len = max(len(b), len(str(a)))

print(max_len)

Solution (Python):
import numpy as np
N = int(raw_input())

def length(x):
    return int(np.floor(np.log10(x))) + 1

def F(A, B):
    return max(length(A), length(B))

def EstimateRoot(y):
    return int(np.floor(np.sqrt(y)))
    
minF = 11
candidates = []
for i in xrange(EstimateRoot(N)):
    if N % (i + 1) == 0:
        candidates.append((i + 1, N/(i + 1)))
for c in candidates:
    f = F(c[0], c[1])
    if f < minF:
        minF = f
print minF

Solution (Python):
MAX = 100000


def F(A, B):
    return max(len(str(A)), len(str(B)))

N = int(input())

res = 100
for a in range(1, MAX):
    if N % a == 0:
        res = min(res, F(a, N // a))

print(res)

Solution (Python):
N = int(input())

rN = int(pow(N, (1/2)))+1

minf = float("inf")
for i in range(1,rN):
	if (N//i) * i == N:
		minf = min(minf,max(len(str(i)),len(str(N//i))))

print(minf)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    n = I()
    s = int(math.sqrt(n))+1
    t = n
    for i in range(s,0,-1):
        if n % i == 0:
            t = max(n//i,i)
            break
    ti = 0
    while t > 0:
        ti += 1
        t //= 10
    return ti



print(main())

Solution (Python):
from math import sqrt,log10,floor

INF = 10 ** 10

n = int(input())

ans = INF
for i in range(1,floor(sqrt(n))+1):
    if n % i == 0:
        ans = min(ans,floor(log10(max(i,n//i)))+1)
print(ans)

Solution (Python):
n = int(input())

ans = 1e10

for i in range(1,n+1):
	if i*i > n:
		break
	if n%i != 0:
		continue
	a = i
	b = n//i
	ans = min(ans, max(len(str(a)), len(str(b))))
print(ans)

Solution (Python):
if __name__ == "__main__":
    N = int(input())
    if (N == 1):
        print (1)
        exit()
    res = 1 << 50
    for x in range(1, N):
        if (x * x > N):
            break
        if (N % x == 0):
            a = len(str(x))
            b = len(str(N // x))
            res = min(res, max(a, b))
    print (res)

Solution (Python):
from math import sqrt


def F(a, b):
    return max(len(str(a)), len(str(b)))

N = int(input())

best = 1<<30
for A in range(1, int(sqrt(N)) + 1):
    B = N // A
    if A * B != N:
        continue
    c = F(A, B)
    if best > c:
        best = c

print(best)

Solution (Python):
def divisor(x):
    div=[]
    for i in xrange(1,int(x**0.5)+1):
        if x%i==0:
            div.append(i)
            if i!=x/i:
                div.append(x/i)
    return div

n=int(raw_input())
ans=100
d=divisor(n)
for i in xrange(len(d)):
    a=str(d[i])
    b=str(n/d[i])
    ans=min(ans,max(len(a),len(b)))
print ans

Solution (Python):
import sys

def solve():
    N = int(input())
    ans = 20

    for a in range(1, N + 1):
        if a**2 > N:
            break
        if N % a:
            continue

        b = N // a
        
        f = max(len(str(a)), len(str(b)))
        ans = min(ans, f)

    print(ans)


def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

if __name__ == '__main__':
    solve()

Solution (Python):
def ri():
    return map(int, raw_input().split())

n = ri()[0]

ans = n
for i in xrange(1, int(n**0.5) + 10):
    if n % i == 0:
        ans = n / i

print len(str(ans))

Solution (Python):
def keta(n):
    return len(str(n))

def F(a, b):
    return max(keta(a), keta(b))

N = input()

i = 1
ans = float('inf')
while i * i <= N:
    if N % i == 0:
        ans = min(ans, F(i, N/i))
    i += 1
print ans

Solution (Python):
import sys

stdin = sys.stdin


def na(): return map(int, stdin.readline().split())


def ns(): return stdin.readline().strip()

n = int(ns())
i = 1
mi = n
while i*i <= n:
    if n % i == 0:
        x = n//i
        mi = min(mi, x)
    i += 1
print(len(str(mi)))