higher-multiples-of-triangular-numbers

Archith loves to play with number series. Archith asked his girlfriend to a date. But she was busy in solving the homework on triangular series which stated that find the least number which has higher divisors than n in a triangular series. His girlfriend made a condition that if he solves this assignment for her she will come for date. Archith dont want to waste time he is developing a code. Put yourself in the position of archith and solve this problem.(#projecteuler 13)

INPUT:
T test cases
every t lines consists of a number n which specifies the no of divisors.
OUTPUT:
output the least triangular number which has higher no of divisors than n.

1<T<11
1<n<10^2

example:

triangular series will be as follows 1,3,6,10........
if n =2
6 has 4 divisors.So 6 will be the least number to have more than n divisors.

SAMPLE INPUT
4
1
2
3
4

SAMPLE OUTPUT
3
6
6
28

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
from math import sqrt
def factors(n):
	final = set()
	for i in range(1,int(sqrt(n))+1):
		if n%i == 0:
			final.add(i)
			final.add(n/i)
	return len(final)

for i in range(eval(input())):
	num = eval(input())
	diff = 3
	start = 3
	ans = start
	while factors(start) <= num:
		start += diff
		diff += 1
		ans = start
	print(ans)


import math

tri = []
fact = []
fact.append(0)
fact.append(1)
tri.append(0)
tri.append(1)
for i in range(2, 1001):
	value = ((i+1)*(i))/2
	tri.append(value)
	cnt = 2
	k = 2
	while k <= math.sqrt(value):
		if value % k == 0:
			cnt += 2
		k+=1
	if int(math.sqrt(value)) * int(math.sqrt(value)) == value:
		cnt -= 1
	fact.append(cnt)
	
#print tri
#print fact
t = eval(input())
while t>0:
	t-=1
	n = eval(input())
	res = 0
	for i in range(1, len(fact)+1):
		if fact[i] > n:
			print(tri[i])
			break


def divi(a):
	c=0
	for i in range(1,a+1):
		if a%i==0:
			c+=1
	return c
for i in range(eval(input())):
	n=eval(input());s=1;c=1
	while True:
		if divi(s)>n:
			print(s)
			break
		c=c+1
		s=s+c


def fac(x):
	i=1
	count=0
	while i*i<x:
		if x%i==0:count+=2
		i+=1
	if (x/i)==i:count+=1
	return count





test=int(input())
for i in range(test):
	num=int(input())
	n=num
	while True:
		tri=(n*(n+1))/2
		if fac(tri)>num:
			print(tri)
			break
		n+=1


from functools import reduce
def factors(n):    
	return set(reduce(list.__add__, 
				([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))

a,j=[3],3
for i in range(1,1000):
	a.append(a[i-1]+j)
	j+=1

	
for _ in range(eval(input())):
	x=eval(input())
	for k in a:
		if(len(factors(k))>x):
			print(k)
			break
		


def fac(x):
	i=1
	count=0
	while i*i<x:
		if x%i==0:count+=2
		i+=1
	if (x/i)==i:count+=1
	return count





test=int(input())
for i in range(test):
	num=int(input())
	n=num
	while True:
		tri=(n*(n+1))/2
		if fac(tri)>num:
			print(tri)
			break
		n+=1


def divi(a):
	c=0
	for i in range(1,a+1):
		if a%i==0:
			c+=1
	return c
for i in range(eval(input())):
	n=eval(input());s=1;c=1
	while True:
		if divi(s)>n:
			print(s)
			break
		c=c+1
		s=s+c


def div(n):
	c=0
	for i in range(1,int(n**.5)+1):
		if n%i==0:
			c+=1
			if n/i!=i:
				c+=1
	return c
x=[1]
for j in range(2,10**4):
	x.append(x[-1]+j)
#print x
y=[div(i) for i in x]
#print y
for _ in range(eval(input())):
	n=eval(input())
	i=0
	while y[i]<=n:
		i+=1
	print(x[i])