Number theory

how to find total number of factor of any number less than a given number ?

You might want to go through the entire thread:

Please look up the forum before asking questions straightaway.

i am not asking number of factors of a number , the question is total number of a factors less than a given number x for each query…
ex: let, n = 36 and x=12 where 1<=n <=1000000 and 1<=x<=10000
so , 36 = 1,2,3,4,6,9,12,18,36.
so answer is 5 …

I read your query and I am here with my solution. I hope it helps

n = int(input("Enter large number: "))
x = int(input("Enter your limit: "))

factors = []
for i in range(2,n):
if n%i == 0 and i<x:
factors.append(i)
print(factors, f"Number of factors = {len(factors)}")

it will give tle

wdym?
Was that all you needed or is there something else?

your approach is right but constraint is large so it will give tle

What is tle?

TIME LIMIT EXCEED

Just link to the Problem rather than making us guess what you want.

4 Likes

this is from the ongoing long challenge…

2 Likes