Skip to content

Instantly share code, notes, and snippets.

@lakshay-arora
Created September 18, 2019 10:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lakshay-arora/7b68539c9a1e22ac9d1f94f98d961fd0 to your computer and use it in GitHub Desktop.
Save lakshay-arora/7b68539c9a1e22ac9d1f94f98d961fd0 to your computer and use it in GitHub Desktop.
# importing required libraries
import pandas as pd
import math
import multiprocessing as mp
from random import randint
# function to calculate the number of divisors
def countDivisors(n) :
count = 0
for i in range(1, (int)(math.sqrt(n)) + 1) :
if (n % i == 0) :
if (n / i == i) :
count = count + 1
else :
count = count + 2
return count
# create random data
random_data = [randint(10,1000) for i in range(1,1000001)]
data = pd.DataFrame({'Number' : random_data })
data.shape
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment