The integers 14 and 15, are contiguous (1 the difference between them, obvious) and have the same number of divisors.
```python
14 ----> 1, 2, 7, 14 (4 divisors)
15 ----> 1, 3, 5, 15 (4 divisors)
```
The next pair of contiguous integers with this property is 21 and 22.
```python
21 -----> 1, 3, 7, 21 (4 divisors)
22 -----> 1, 2, 11, 22 (4 divisors)
```
We have 8 pairs of integers below 50 having this property, they are:
```python
[[2, 3], [14, 15], [21, 22], [26, 27], [33, 34], [34, 35], [38, 39], [44, 45]]
```
Let's see now the integers that have a difference of 3 between them. There are seven pairs below 100:
```python
[[2, 5], [35, 38], [55, 58], [62, 65], [74, 77], [82, 85], [91, 94]]
```
Let's name, diff, the difference between two integers, next and prev, (diff = next - prev) and nMax, an upper bound of the range.

We need a special function, count_pairsInt(), that receives two arguments, diff and nMax and outputs the amount of pairs of integers that fulfill this property, all of them being smaller (not smaller or equal) than nMax.

Let's see it more clearly with examples.
```python
count_pairsInt(1, 50) -----> 8 (See case above)
count_pairsInt(3, 100) -----> 7 (See case above)
```

Happy coding!!!

Difficulty: introductory

Starter code:

def count_pairs_int(diff, n_max):
	

Solutions:
def count_pairs_int(d, m):
    return sum(1 for i in range(1, m - d) if divisors(i) == divisors(i + d))

def divisors(n):
    return sum(1 + (n // k != k) for k in range(1, int(n**0.5) + 1) if n % k == 0)


import numpy as np

N = 100001
xs = np.ones(N)
xs[:2] = 0
for i in range(2, N//2):
    xs[i*2::i] += 1


def count_pairs_int(diff, n_max):
    return sum(
        xs[i] == xs[i + diff]
        for i in range(1, n_max - diff)
    )

TOP = 20000
CNT = [1]*TOP
for i in range(2,TOP):
    for j in range(i,TOP,i): CNT[j]+=1


def count_pairs_int(diff, n_max):
    return sum(CNT[a]==CNT[a+diff] for a in range(1,n_max-diff))

import math
def divisorGenerator(n):       #求所有除数
    large_divisors = []
    for i in range(1, int(math.sqrt(n) + 1)):
        if n % i == 0:
            yield i
            if i*i != n:
                large_divisors.append(n / i)
    for divisor in reversed(large_divisors):
        yield divisor
        
def count_pairs_int(diff, n_max):
    div_num = []
    count = 0
    for i in range(1,n_max+1):
        div_num.append(len(list(divisorGenerator(i))))
    print(div_num,len(div_num))
    for j in range(diff,len(div_num)-1):
        #print(j,':','div_num[',j+1,']=',div_num[j+1],'div_num[',j,']=',div_num[j],'diff=',div_num[j+1]-div_num[j])
        if div_num[j] == div_num[j-diff]:
            count += 1
    return count

def count_pairs_int(d,n):
    def divs(n):
        x = set()
        for i in range(1,int(n**.5)+1):
            if not n%i:
                x |= {i,n//i}
        return len(x)
        
    c = 0
    for i in range(1,n-d):
        if divs(i) == divs(i+d):
            c += 1
    
    return c

def diviseurs_stricts(nombre):
    diviseurs = [1, nombre]
    candidat = 2
    while candidat < nombre // candidat:
        if nombre % candidat == 0:   # candidat est un diviseur de nombre
            diviseurs.append(candidat)
            diviseurs.append(nombre // candidat)
        candidat += 1
    if candidat * candidat == nombre: # nombre est un carré
        diviseurs.append(candidat)
    return len(diviseurs)

def count_pairs_int(difference, limit):
    ok_list = []
    for number in range(2,limit-difference):
        if diviseurs_stricts(number) == diviseurs_stricts(number + difference):
            ok_list.append([number, number+difference])
    return len(ok_list)

def count_pairs_int(dif, n_max):
    _c=((range(1,n_max)[i],range(1,n_max)[i+dif]) for i in range(0,len(range(1,n_max))-dif))
    def v(x):
        _s=[]
        for k in range(1,int(x**0.5)+1):
            if x%k==0:
                _s.append(k)
                _s.append(x/k)
        return len(set(_s))
    return len([i for i in _c if v(i[0])==v(i[1])])

import math
def divisors(n) : 
    ans = 0
    for i in range(1, (int)(math.sqrt(n)) + 1) : 
        if n % i == 0: 
            if n / i == i: 
                ans += 1
            else:
                ans += 2                  
    return ans 

def count_pairs_int(diff, nmax):
    ans = 0
    for val in range(2, nmax-diff):
        if divisors(val) == divisors(val+diff):
            ans += 1
    return ans 

def count_pairs_int(diff, below):
    nds = [0] * below
    for i in range(1, below):
        for j in range(i, below, i):
            nds[j] += 1
    return sum(x == y for x, y in zip(nds, nds[diff:]))

import math

def getDivisors(n):
    divisors = set()
    e = 1
    while e <= math.sqrt(n):
        if n % e == 0: 
            divisors.update([e,n/e])
        e += 1
    return divisors
            
def buildDict(n_max):
    res = {}
    for i in range(1,n_max):
        res[i] = len( getDivisors(i) ) 
    return res        

def count_pairs_int(diff, n_max):
    d = buildDict(n_max)
    x = 0
    for n in range(n_max):
        if d.get(n, 0) == d.get(n+diff, 0):  
            x += 1            
    return x