Message Boards Message Boards

Use Sum while the summand is a function?

GROUPS:

Mathematica 11.3.0.0 Windows 10 64

Before posting a bug, I would like if anybody can verify:

The following works o.k:

Sum[Times @@ (IntegerDigits[i, 7] + 1), {i, 0, 10^6}]

However if the Summand is a function we get some gibberish:

fu[n_] := Times @@ (IntegerDigits[n, 7] + 1);

Sum[fu[i], {i, 0, 10^6}]

Interestingly, the following works:

Sum[fu[i], {i, 1, 10^6}]
POSTED BY: Daniel Huber
Answer
10 days ago

Sum can do this "procedurally", and the default method (Automatic) apparently does so when given the explicit summand. With the function form it only does the procedural when the number of terms is under a certain limit, by default 10^6. The two examples straddle this limit, hence the observed behavior. One can change this default as below.

SetSystemOptions["SymbolicSumThreshold" -> 1000001];

fu[n_] := Times @@ (IntegerDigits[n, 7] + 1)
Sum[fu[i], {i, 0, 10^6}]

(* Out[49]= 14938433536 *)
POSTED BY: Daniel Lichtblau
Answer
10 days ago

Hi Daniel (Lichtblau), it's a pleasure hearing from again. It has been a long time, you may not remember. Daniel (Huber)

POSTED BY: Daniel Huber
Answer
9 days ago

Daniel (Huber), yes, I remember you. Goes back a ways...

POSTED BY: Daniel Lichtblau
Answer
9 days ago

Group Abstract Group Abstract