Performance question: The fastest way to calculate sum(p*ln(p)) for 10 million numbers p

Hi guys, I have a question about performance.

We need to calculate the the sum of p*ln(p) for about 10 million numbers. A nested loop inside a “Column Expression” node takes about a minute to calculate the result of 10 million numbers. Unfortunately we have about twenty thousand batches of 10 million numbers, which in total will take us about two weeks to calculate. We were wondering, is there a more efficient way to make this calculation?

Specifically, the calculation is:

1.

Given constant doubles k and d, calculate

p_n := k + n*d (n=1…10M)

1.

For each p_n, we calculate the product

pn*ln(pn)

1.

Sum of all pn*ln(pn) for n=1…10M

Trying to speed this up we tried generating a table with 10 million numbers and making the calculation, but it takes even longer than the nested loop. We were wondering what is the fastest way to make this calculation. For example, using a Python node, a JavaScript node, a Groovy node, or else?

Many thanks!