Esempio n. 1
0
  [2, 16],
  [2, 2, 8],
  [2, 2, 2, 4],
  [2, 2, 2, 2, 2]
]

[[2, 16], [2, 2, 8], [2, 2, 2, 4], [2, 2, 2, 2, 2], [2, 4, 4], [4, 8]]

"""
n = 37
n2 = 32
print(get_factors(37))

print(get_factors(32))

print(get_factors_iterative1(37))

print(get_factors_iterative2(32))

################################
"""
## 소인수분해 
n=int(input())
alist=[]
while n>=2:
    for i in range(2,n):
        if n%i==0:
            alist.append(i)
            n=n//i
            #print(n)
            break
 def test_get_factors_iterative1(self):
     self.assertEqual(
         [[2, 16], [4, 8], [2, 2, 8], [2, 4, 4], [2, 2, 2, 4],
          [2, 2, 2, 2, 2]],
         get_factors_iterative1(32),
     )
Esempio n. 3
0
 def test_get_factors_iterative1(self):
     self.assertEqual([[2, 16], [4, 8], [2, 2, 8], [2, 4, 4], [2, 2, 2, 4], [2, 2, 2, 2, 2]],
     get_factors_iterative1(32))