#Octave, 45 bytes
Octave, 45 bytes
@(n)sum(all(isprime(m=[h=3:n-1;h-2]))*m'.^-1)
Explanation:
m=[h=3:n-1;h-2] generate an concatenate two ranges 3:n-1 and 1:n-3
rec=m'.^-1 transpose and reciprocal
idx=all(isprime(m)) create a logical [0 1 ..] array if both ranges are prime set 1 else set 0
sum1 = idx * rec matrix multiplication(extrat elements with logical index and sum along the first dimension)
sum(sum1) sum along the second dimension
#Octave, 45 bytes
@(n)sum(all(isprime(m=[h=3:n-1;h-2]))*m'.^-1)
Explanation:
m=[h=3:n-1;h-2] generate an concatenate two ranges 3:n-1 and 1:n-3
rec=m'.^-1 transpose and reciprocal
idx=all(isprime(m)) create a logical [0 1 ..] array if both ranges are prime set 1 else set 0
sum1 = idx * rec matrix multiplication(extrat elements with logical index and sum along the first dimension)
sum(sum1) sum along the second dimension
Octave, 45 bytes
@(n)sum(all(isprime(m=[h=3:n-1;h-2]))*m'.^-1)
Explanation:
m=[h=3:n-1;h-2] generate an concatenate two ranges 3:n-1 and 1:n-3
rec=m'.^-1 transpose and reciprocal
idx=all(isprime(m)) create a logical [0 1 ..] array if both ranges are prime set 1 else set 0
sum1 = idx * rec matrix multiplication(extrat elements with logical index and sum along the first dimension)
sum(sum1) sum along the second dimension
#Octave, 45 bytes
@(n)sum(all(isprime(m=[h=3:n-1;h-2]))*m'.^-1)
Explanation:
m=[h=3:n-1;h-2] generate an concatenate two ranges 3:n-1 and 1:n-3
rec=m'.^-1 transpose and reciprocal
idx=all(isprime(m)) create a logical [0 1 ..] array if both ranges are prime set 1 else set 0
sum1 = idx * rec matrix multiplication(extrat elements with logical index and sum along the first dimension)
sum(sum1) sum along the second dimension