Message Boards Message Boards

0
|
3610 Views
|
3 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Use Sum while the summand is a function?

Posted 6 years ago

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
3 Replies

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
Posted 6 years 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

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

POSTED BY: Daniel Lichtblau
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract