Given
p={2, 3, 5, 7, 11, 13, 17, 19}
I want to get the values which can be calculated by
Table[(p[[i + 1]]*p[[i + 3]] - p[[i]]*p[[i + 2]]), {i, 5}]
resulting in
{11, 34, 36, 96, 60}
I also can do it by
p4 = Partition[p, 4, 1];
f[a_, b_, c_, d_] := bd - ac
f[#, #2, #3, #4] & @@@ p4
What would be a concise way using FoldList without using Partition beforehand?
f[#, #2, #3, #4] & @@@ p4, justf@@@p4do the job. – AsukaMinato Mar 29 '21 at 12:59