var arrF = [1]
var arrS = [1,2]
var numbers = [1]
let last = numbers.last
var x = 1
var equals = [1]
while arrF.count < 63 {
numbers.append((last! + 1))
arrF.append(numbers.reduce(1, combine: *))
}
for (index, value) in arrF.enumerate() {
arrF[index] = Int(sqrt(Double(value)))
}
while arrS.count < 63 {
arrS.append(arrS.reduce(0, combine: +))
}
while x < 63 {
let a = arrF[x]
let b = arrS[x]
if a == b {
equals.append(a * a)
}
x++
}
print(equals)
The code above searches for factorial numbers where the square root equals the sum of its original factors. It works fine, but if I make the while loops go on after 63 I get an "Dab Instruction error" in the reduce function line. Does anyone know how to fix this, has the reduce function a restriction?