31 lines
731 B
Text
31 lines
731 B
Text
|
|
F factors(Int n)
|
|||
|
|
V f = Set([1, n])
|
|||
|
|
V i = 2
|
|||
|
|
L
|
|||
|
|
V j = n I/ i
|
|||
|
|
I j < i
|
|||
|
|
L.break
|
|||
|
|
I i * j == n
|
|||
|
|
f.add(i)
|
|||
|
|
f.add(j)
|
|||
|
|
i++
|
|||
|
|
R f
|
|||
|
|
|
|||
|
|
V arithmetic_count = 0
|
|||
|
|
V composite_count = 0
|
|||
|
|
V n = 1
|
|||
|
|
L arithmetic_count <= 1000000
|
|||
|
|
V f = factors(n)
|
|||
|
|
I sum(f) % f.len == 0
|
|||
|
|
arithmetic_count++
|
|||
|
|
I f.len > 2
|
|||
|
|
composite_count++
|
|||
|
|
I arithmetic_count <= 100
|
|||
|
|
print(f:‘{n:3} ’, end' ‘’)
|
|||
|
|
I arithmetic_count % 10 == 0
|
|||
|
|
print()
|
|||
|
|
I arithmetic_count C (1000, 10000, 100000, 1000000)
|
|||
|
|
print("\n"arithmetic_count‘th arithmetic number is ’n)
|
|||
|
|
print(‘Number of composite arithmetic numbers <= ’n‘: ’composite_count)
|
|||
|
|
n++
|