Jump to content

Penholodigital squares: Difference between revisions

→‎{{header|Go}}: Updated in line with Wren example - about 5 x speed up.
(→‎{{header|Wren}}: Optimized - about 7 x speed up.)
(→‎{{header|Go}}: Updated in line with Wren example - about 5 x speed up.)
Line 83:
smax, _ := strconv.ParseInt(reverse(digits[0:b-1]), b, 64)
max := int(math.Floor(math.Sqrt(float64(smax))))
factors := rcu.PrimeFactors(b - 1)
div := factors[len(factors)-1]
for i := min; i <= max; i++ {
sq :=if (i *% idiv) != 0 {
if b == 10 && (sq%3) != 0 {
continue
}
if bsq =:= 10 && (sq%3) !=i 0* {i
digs := rcu.Digits(sq, b)
containsZero := false
key := 1
for _, dig := range digs {
if dig == 0 {
Line 95 ⟶ 98:
break
}
key *= primes[dig-1]
}
if containsZero {
continue
}
key := 1
for _, dig := range digs {
key *= primes[dig-1]
}
if key == master {
9,486

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.