Triples Product

You are given a function:

Long findTriplets(long N)

The function accepts long integer N. 

Implement the function to return the number of triplets of positive integer (p,q,r) such that p<=q<=r and p*q*r<=N

 

Example:

Input:

4

Output:

 5

Explanation:

There are 5 such triplets {1,1,1},{1,1,2},{1,1,3},{1,1,4} and {1,2,2}

 

Code:

from itertools import product

N = int(input())

array=[]

for i in range(1,N+1):

    array.append(i)

comb = product(array,repeat=3)

arraycomb=list(comb)

count=0 

for i in arraycomb:

    if(i[0]<=i[1]):

        if(i[1]<=i[2]):

            x=i[0]

            y=i[1]

            z=i[2]

            if(x*y*z<=N):

                count=count+1

print(count)


Note:Not the best code!!!. Comment yours too