List Interval Sum
$begingroup$
I am doing a large data-set computation. Among those computational steps, in one step I need to do a sum with a pattern: Sum the elements with same interval.
For example, for a list from 1 to 9; With the interval being set to 3 manually. So it could be other values in different cases.
And the list would be calculated as:
1 + 4 + 7 = 12;
2 + 5 + 8 = 15;
3 + 6 + 9 = 18;
So for list = Range[1,9]
,the final desired result would be {12,15,18}
in this example. I attached an illustration for a further elaboration: sum the element with the same color when interval = 3:
Thanks for @Chris's Answer, the above case could be solved by:
Total[Partition[Range[9], 3]]
Edit my original question from here:
But what I actually want to do is only sum "N" numbers in a time. N is settled and when N = 3 in below example:
It should be computed by :
1 + 4 + 7 = 12;
2 + 5 + 8 = 15;
3 + 6 + 9 = 18;
10 + 13 + 16 = 39;
11 + 14 + 17 = 42;
12 + 15 + 18 = 45;
Hereby the result would be {12,15,18,39,42,45}
I think this might be not hard, but I just can't think it very clearly when I want to utilize the parallelization characteristics of MMA and trying to avoid Unpacked Array
results.
list-manipulation
$endgroup$
add a comment |
$begingroup$
I am doing a large data-set computation. Among those computational steps, in one step I need to do a sum with a pattern: Sum the elements with same interval.
For example, for a list from 1 to 9; With the interval being set to 3 manually. So it could be other values in different cases.
And the list would be calculated as:
1 + 4 + 7 = 12;
2 + 5 + 8 = 15;
3 + 6 + 9 = 18;
So for list = Range[1,9]
,the final desired result would be {12,15,18}
in this example. I attached an illustration for a further elaboration: sum the element with the same color when interval = 3:
Thanks for @Chris's Answer, the above case could be solved by:
Total[Partition[Range[9], 3]]
Edit my original question from here:
But what I actually want to do is only sum "N" numbers in a time. N is settled and when N = 3 in below example:
It should be computed by :
1 + 4 + 7 = 12;
2 + 5 + 8 = 15;
3 + 6 + 9 = 18;
10 + 13 + 16 = 39;
11 + 14 + 17 = 42;
12 + 15 + 18 = 45;
Hereby the result would be {12,15,18,39,42,45}
I think this might be not hard, but I just can't think it very clearly when I want to utilize the parallelization characteristics of MMA and trying to avoid Unpacked Array
results.
list-manipulation
$endgroup$
$begingroup$
is the length of the input list always a multiple ofn
? If not, what is the desired output for inputsRange[19]
andRange[20]
?
$endgroup$
– kglr
Dec 5 '18 at 3:09
$begingroup$
The length of list will always beMod[Length[list],N] = 0
, so no worry about corner cases
$endgroup$
– cj9435042
Dec 5 '18 at 3:13
add a comment |
$begingroup$
I am doing a large data-set computation. Among those computational steps, in one step I need to do a sum with a pattern: Sum the elements with same interval.
For example, for a list from 1 to 9; With the interval being set to 3 manually. So it could be other values in different cases.
And the list would be calculated as:
1 + 4 + 7 = 12;
2 + 5 + 8 = 15;
3 + 6 + 9 = 18;
So for list = Range[1,9]
,the final desired result would be {12,15,18}
in this example. I attached an illustration for a further elaboration: sum the element with the same color when interval = 3:
Thanks for @Chris's Answer, the above case could be solved by:
Total[Partition[Range[9], 3]]
Edit my original question from here:
But what I actually want to do is only sum "N" numbers in a time. N is settled and when N = 3 in below example:
It should be computed by :
1 + 4 + 7 = 12;
2 + 5 + 8 = 15;
3 + 6 + 9 = 18;
10 + 13 + 16 = 39;
11 + 14 + 17 = 42;
12 + 15 + 18 = 45;
Hereby the result would be {12,15,18,39,42,45}
I think this might be not hard, but I just can't think it very clearly when I want to utilize the parallelization characteristics of MMA and trying to avoid Unpacked Array
results.
list-manipulation
$endgroup$
I am doing a large data-set computation. Among those computational steps, in one step I need to do a sum with a pattern: Sum the elements with same interval.
For example, for a list from 1 to 9; With the interval being set to 3 manually. So it could be other values in different cases.
And the list would be calculated as:
1 + 4 + 7 = 12;
2 + 5 + 8 = 15;
3 + 6 + 9 = 18;
So for list = Range[1,9]
,the final desired result would be {12,15,18}
in this example. I attached an illustration for a further elaboration: sum the element with the same color when interval = 3:
Thanks for @Chris's Answer, the above case could be solved by:
Total[Partition[Range[9], 3]]
Edit my original question from here:
But what I actually want to do is only sum "N" numbers in a time. N is settled and when N = 3 in below example:
It should be computed by :
1 + 4 + 7 = 12;
2 + 5 + 8 = 15;
3 + 6 + 9 = 18;
10 + 13 + 16 = 39;
11 + 14 + 17 = 42;
12 + 15 + 18 = 45;
Hereby the result would be {12,15,18,39,42,45}
I think this might be not hard, but I just can't think it very clearly when I want to utilize the parallelization characteristics of MMA and trying to avoid Unpacked Array
results.
list-manipulation
list-manipulation
edited Dec 5 '18 at 1:29
cj9435042
asked Dec 5 '18 at 0:04
cj9435042cj9435042
34416
34416
$begingroup$
is the length of the input list always a multiple ofn
? If not, what is the desired output for inputsRange[19]
andRange[20]
?
$endgroup$
– kglr
Dec 5 '18 at 3:09
$begingroup$
The length of list will always beMod[Length[list],N] = 0
, so no worry about corner cases
$endgroup$
– cj9435042
Dec 5 '18 at 3:13
add a comment |
$begingroup$
is the length of the input list always a multiple ofn
? If not, what is the desired output for inputsRange[19]
andRange[20]
?
$endgroup$
– kglr
Dec 5 '18 at 3:09
$begingroup$
The length of list will always beMod[Length[list],N] = 0
, so no worry about corner cases
$endgroup$
– cj9435042
Dec 5 '18 at 3:13
$begingroup$
is the length of the input list always a multiple of
n
? If not, what is the desired output for inputs Range[19]
and Range[20]
?$endgroup$
– kglr
Dec 5 '18 at 3:09
$begingroup$
is the length of the input list always a multiple of
n
? If not, what is the desired output for inputs Range[19]
and Range[20]
?$endgroup$
– kglr
Dec 5 '18 at 3:09
$begingroup$
The length of list will always be
Mod[Length[list],N] = 0
, so no worry about corner cases$endgroup$
– cj9435042
Dec 5 '18 at 3:13
$begingroup$
The length of list will always be
Mod[Length[list],N] = 0
, so no worry about corner cases$endgroup$
– cj9435042
Dec 5 '18 at 3:13
add a comment |
3 Answers
3
active
oldest
votes
$begingroup$
Total[Partition[Range[9], 3]]
{12, 15, 18}
Update for revised question:
r = Range[18]
Total /@ Flatten[Partition[#, 3] & /@ {r[[1 ;; ;; 3]], r[[2 ;; ;; 3]], r[[3 ;; ;; 3]]}, 1]
$endgroup$
$begingroup$
Hi Chris, sorry I wasn't clarify the problem clearly. I just updated my question would you still interest to help?
$endgroup$
– cj9435042
Dec 5 '18 at 1:30
add a comment |
$begingroup$
Using the six-argument form of Partition
:
Join @@ Partition[Partition[Range[9], 3], 3, 3, {1, 1}, {}, Plus]
{12, 15, 18}
Join @@ Partition[Partition[Range[18], 3], 3, 3, {1, 1}, {}, Plus]
{12, 15, 18, 39, 42, 45}
More generally,
ClearAll[partsums]
partsums[lst_List, n_Integer] := Join@@Partition[Partition[lst, n], n, n, {1,1}, {}, Plus]
Examples:
partsums[Range[18], 3]
{12, 15, 18, 39, 42, 45}
Grid[Prepend[Table[{i, Column[i Range[7]], Column[partsums[Range@#, i] & /@
(i Range[7])]}, {i, {3, 4, 5}}], {"n", "Length@list" , "f[list, n]"}],
Alignment -> Center, Dividers -> All] // TeXForm
$smallbegin{array}{|c|c|c|}
hline
text{n} & text{Length@list} & text{f[list, n]} \
hline
3 &
begin{array}{l}
3 \
6 \
9 \
12 \
15 \
18 \
21 \
end{array}
&
begin{array}{l}
{1,2,3} \
{5,7,9} \
{12,15,18} \
{12,15,18,10,11,12} \
{12,15,18,23,25,27} \
{12,15,18,39,42,45} \
{12,15,18,39,42,45,19,20,21} \
end{array}
\
hline
4 &
begin{array}{l}
4 \
8 \
12 \
16 \
20 \
24 \
28 \
end{array}
&
begin{array}{l}
{1,2,3,4} \
{6,8,10,12} \
{15,18,21,24} \
{28,32,36,40} \
{28,32,36,40,17,18,19,20} \
{28,32,36,40,38,40,42,44} \
{28,32,36,40,63,66,69,72} \
end{array}
\
hline
5 &
begin{array}{l}
5 \
10 \
15 \
20 \
25 \
30 \
35 \
end{array}
&
begin{array}{l}
{1,2,3,4,5} \
{7,9,11,13,15} \
{18,21,24,27,30} \
{34,38,42,46,50} \
{55,60,65,70,75} \
{55,60,65,70,75,26,27,28,29,30} \
{55,60,65,70,75,57,59,61,63,65} \
end{array}
\
hline
end{array}$
$endgroup$
add a comment |
$begingroup$
Total@Take[Range@9, {#, -1, 3}] & /@ Range@3
{12, 15, 18}
or..
Total /@ Transpose@Partition[Range@9, 3]
{12, 15, 18}
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "387"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f187334%2flist-interval-sum%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Total[Partition[Range[9], 3]]
{12, 15, 18}
Update for revised question:
r = Range[18]
Total /@ Flatten[Partition[#, 3] & /@ {r[[1 ;; ;; 3]], r[[2 ;; ;; 3]], r[[3 ;; ;; 3]]}, 1]
$endgroup$
$begingroup$
Hi Chris, sorry I wasn't clarify the problem clearly. I just updated my question would you still interest to help?
$endgroup$
– cj9435042
Dec 5 '18 at 1:30
add a comment |
$begingroup$
Total[Partition[Range[9], 3]]
{12, 15, 18}
Update for revised question:
r = Range[18]
Total /@ Flatten[Partition[#, 3] & /@ {r[[1 ;; ;; 3]], r[[2 ;; ;; 3]], r[[3 ;; ;; 3]]}, 1]
$endgroup$
$begingroup$
Hi Chris, sorry I wasn't clarify the problem clearly. I just updated my question would you still interest to help?
$endgroup$
– cj9435042
Dec 5 '18 at 1:30
add a comment |
$begingroup$
Total[Partition[Range[9], 3]]
{12, 15, 18}
Update for revised question:
r = Range[18]
Total /@ Flatten[Partition[#, 3] & /@ {r[[1 ;; ;; 3]], r[[2 ;; ;; 3]], r[[3 ;; ;; 3]]}, 1]
$endgroup$
Total[Partition[Range[9], 3]]
{12, 15, 18}
Update for revised question:
r = Range[18]
Total /@ Flatten[Partition[#, 3] & /@ {r[[1 ;; ;; 3]], r[[2 ;; ;; 3]], r[[3 ;; ;; 3]]}, 1]
edited Dec 5 '18 at 2:16
answered Dec 5 '18 at 0:10
ChrisChris
54126
54126
$begingroup$
Hi Chris, sorry I wasn't clarify the problem clearly. I just updated my question would you still interest to help?
$endgroup$
– cj9435042
Dec 5 '18 at 1:30
add a comment |
$begingroup$
Hi Chris, sorry I wasn't clarify the problem clearly. I just updated my question would you still interest to help?
$endgroup$
– cj9435042
Dec 5 '18 at 1:30
$begingroup$
Hi Chris, sorry I wasn't clarify the problem clearly. I just updated my question would you still interest to help?
$endgroup$
– cj9435042
Dec 5 '18 at 1:30
$begingroup$
Hi Chris, sorry I wasn't clarify the problem clearly. I just updated my question would you still interest to help?
$endgroup$
– cj9435042
Dec 5 '18 at 1:30
add a comment |
$begingroup$
Using the six-argument form of Partition
:
Join @@ Partition[Partition[Range[9], 3], 3, 3, {1, 1}, {}, Plus]
{12, 15, 18}
Join @@ Partition[Partition[Range[18], 3], 3, 3, {1, 1}, {}, Plus]
{12, 15, 18, 39, 42, 45}
More generally,
ClearAll[partsums]
partsums[lst_List, n_Integer] := Join@@Partition[Partition[lst, n], n, n, {1,1}, {}, Plus]
Examples:
partsums[Range[18], 3]
{12, 15, 18, 39, 42, 45}
Grid[Prepend[Table[{i, Column[i Range[7]], Column[partsums[Range@#, i] & /@
(i Range[7])]}, {i, {3, 4, 5}}], {"n", "Length@list" , "f[list, n]"}],
Alignment -> Center, Dividers -> All] // TeXForm
$smallbegin{array}{|c|c|c|}
hline
text{n} & text{Length@list} & text{f[list, n]} \
hline
3 &
begin{array}{l}
3 \
6 \
9 \
12 \
15 \
18 \
21 \
end{array}
&
begin{array}{l}
{1,2,3} \
{5,7,9} \
{12,15,18} \
{12,15,18,10,11,12} \
{12,15,18,23,25,27} \
{12,15,18,39,42,45} \
{12,15,18,39,42,45,19,20,21} \
end{array}
\
hline
4 &
begin{array}{l}
4 \
8 \
12 \
16 \
20 \
24 \
28 \
end{array}
&
begin{array}{l}
{1,2,3,4} \
{6,8,10,12} \
{15,18,21,24} \
{28,32,36,40} \
{28,32,36,40,17,18,19,20} \
{28,32,36,40,38,40,42,44} \
{28,32,36,40,63,66,69,72} \
end{array}
\
hline
5 &
begin{array}{l}
5 \
10 \
15 \
20 \
25 \
30 \
35 \
end{array}
&
begin{array}{l}
{1,2,3,4,5} \
{7,9,11,13,15} \
{18,21,24,27,30} \
{34,38,42,46,50} \
{55,60,65,70,75} \
{55,60,65,70,75,26,27,28,29,30} \
{55,60,65,70,75,57,59,61,63,65} \
end{array}
\
hline
end{array}$
$endgroup$
add a comment |
$begingroup$
Using the six-argument form of Partition
:
Join @@ Partition[Partition[Range[9], 3], 3, 3, {1, 1}, {}, Plus]
{12, 15, 18}
Join @@ Partition[Partition[Range[18], 3], 3, 3, {1, 1}, {}, Plus]
{12, 15, 18, 39, 42, 45}
More generally,
ClearAll[partsums]
partsums[lst_List, n_Integer] := Join@@Partition[Partition[lst, n], n, n, {1,1}, {}, Plus]
Examples:
partsums[Range[18], 3]
{12, 15, 18, 39, 42, 45}
Grid[Prepend[Table[{i, Column[i Range[7]], Column[partsums[Range@#, i] & /@
(i Range[7])]}, {i, {3, 4, 5}}], {"n", "Length@list" , "f[list, n]"}],
Alignment -> Center, Dividers -> All] // TeXForm
$smallbegin{array}{|c|c|c|}
hline
text{n} & text{Length@list} & text{f[list, n]} \
hline
3 &
begin{array}{l}
3 \
6 \
9 \
12 \
15 \
18 \
21 \
end{array}
&
begin{array}{l}
{1,2,3} \
{5,7,9} \
{12,15,18} \
{12,15,18,10,11,12} \
{12,15,18,23,25,27} \
{12,15,18,39,42,45} \
{12,15,18,39,42,45,19,20,21} \
end{array}
\
hline
4 &
begin{array}{l}
4 \
8 \
12 \
16 \
20 \
24 \
28 \
end{array}
&
begin{array}{l}
{1,2,3,4} \
{6,8,10,12} \
{15,18,21,24} \
{28,32,36,40} \
{28,32,36,40,17,18,19,20} \
{28,32,36,40,38,40,42,44} \
{28,32,36,40,63,66,69,72} \
end{array}
\
hline
5 &
begin{array}{l}
5 \
10 \
15 \
20 \
25 \
30 \
35 \
end{array}
&
begin{array}{l}
{1,2,3,4,5} \
{7,9,11,13,15} \
{18,21,24,27,30} \
{34,38,42,46,50} \
{55,60,65,70,75} \
{55,60,65,70,75,26,27,28,29,30} \
{55,60,65,70,75,57,59,61,63,65} \
end{array}
\
hline
end{array}$
$endgroup$
add a comment |
$begingroup$
Using the six-argument form of Partition
:
Join @@ Partition[Partition[Range[9], 3], 3, 3, {1, 1}, {}, Plus]
{12, 15, 18}
Join @@ Partition[Partition[Range[18], 3], 3, 3, {1, 1}, {}, Plus]
{12, 15, 18, 39, 42, 45}
More generally,
ClearAll[partsums]
partsums[lst_List, n_Integer] := Join@@Partition[Partition[lst, n], n, n, {1,1}, {}, Plus]
Examples:
partsums[Range[18], 3]
{12, 15, 18, 39, 42, 45}
Grid[Prepend[Table[{i, Column[i Range[7]], Column[partsums[Range@#, i] & /@
(i Range[7])]}, {i, {3, 4, 5}}], {"n", "Length@list" , "f[list, n]"}],
Alignment -> Center, Dividers -> All] // TeXForm
$smallbegin{array}{|c|c|c|}
hline
text{n} & text{Length@list} & text{f[list, n]} \
hline
3 &
begin{array}{l}
3 \
6 \
9 \
12 \
15 \
18 \
21 \
end{array}
&
begin{array}{l}
{1,2,3} \
{5,7,9} \
{12,15,18} \
{12,15,18,10,11,12} \
{12,15,18,23,25,27} \
{12,15,18,39,42,45} \
{12,15,18,39,42,45,19,20,21} \
end{array}
\
hline
4 &
begin{array}{l}
4 \
8 \
12 \
16 \
20 \
24 \
28 \
end{array}
&
begin{array}{l}
{1,2,3,4} \
{6,8,10,12} \
{15,18,21,24} \
{28,32,36,40} \
{28,32,36,40,17,18,19,20} \
{28,32,36,40,38,40,42,44} \
{28,32,36,40,63,66,69,72} \
end{array}
\
hline
5 &
begin{array}{l}
5 \
10 \
15 \
20 \
25 \
30 \
35 \
end{array}
&
begin{array}{l}
{1,2,3,4,5} \
{7,9,11,13,15} \
{18,21,24,27,30} \
{34,38,42,46,50} \
{55,60,65,70,75} \
{55,60,65,70,75,26,27,28,29,30} \
{55,60,65,70,75,57,59,61,63,65} \
end{array}
\
hline
end{array}$
$endgroup$
Using the six-argument form of Partition
:
Join @@ Partition[Partition[Range[9], 3], 3, 3, {1, 1}, {}, Plus]
{12, 15, 18}
Join @@ Partition[Partition[Range[18], 3], 3, 3, {1, 1}, {}, Plus]
{12, 15, 18, 39, 42, 45}
More generally,
ClearAll[partsums]
partsums[lst_List, n_Integer] := Join@@Partition[Partition[lst, n], n, n, {1,1}, {}, Plus]
Examples:
partsums[Range[18], 3]
{12, 15, 18, 39, 42, 45}
Grid[Prepend[Table[{i, Column[i Range[7]], Column[partsums[Range@#, i] & /@
(i Range[7])]}, {i, {3, 4, 5}}], {"n", "Length@list" , "f[list, n]"}],
Alignment -> Center, Dividers -> All] // TeXForm
$smallbegin{array}{|c|c|c|}
hline
text{n} & text{Length@list} & text{f[list, n]} \
hline
3 &
begin{array}{l}
3 \
6 \
9 \
12 \
15 \
18 \
21 \
end{array}
&
begin{array}{l}
{1,2,3} \
{5,7,9} \
{12,15,18} \
{12,15,18,10,11,12} \
{12,15,18,23,25,27} \
{12,15,18,39,42,45} \
{12,15,18,39,42,45,19,20,21} \
end{array}
\
hline
4 &
begin{array}{l}
4 \
8 \
12 \
16 \
20 \
24 \
28 \
end{array}
&
begin{array}{l}
{1,2,3,4} \
{6,8,10,12} \
{15,18,21,24} \
{28,32,36,40} \
{28,32,36,40,17,18,19,20} \
{28,32,36,40,38,40,42,44} \
{28,32,36,40,63,66,69,72} \
end{array}
\
hline
5 &
begin{array}{l}
5 \
10 \
15 \
20 \
25 \
30 \
35 \
end{array}
&
begin{array}{l}
{1,2,3,4,5} \
{7,9,11,13,15} \
{18,21,24,27,30} \
{34,38,42,46,50} \
{55,60,65,70,75} \
{55,60,65,70,75,26,27,28,29,30} \
{55,60,65,70,75,57,59,61,63,65} \
end{array}
\
hline
end{array}$
edited Dec 5 '18 at 6:33
answered Dec 5 '18 at 4:44
kglrkglr
181k10200413
181k10200413
add a comment |
add a comment |
$begingroup$
Total@Take[Range@9, {#, -1, 3}] & /@ Range@3
{12, 15, 18}
or..
Total /@ Transpose@Partition[Range@9, 3]
{12, 15, 18}
$endgroup$
add a comment |
$begingroup$
Total@Take[Range@9, {#, -1, 3}] & /@ Range@3
{12, 15, 18}
or..
Total /@ Transpose@Partition[Range@9, 3]
{12, 15, 18}
$endgroup$
add a comment |
$begingroup$
Total@Take[Range@9, {#, -1, 3}] & /@ Range@3
{12, 15, 18}
or..
Total /@ Transpose@Partition[Range@9, 3]
{12, 15, 18}
$endgroup$
Total@Take[Range@9, {#, -1, 3}] & /@ Range@3
{12, 15, 18}
or..
Total /@ Transpose@Partition[Range@9, 3]
{12, 15, 18}
answered Dec 5 '18 at 0:08
J42161217J42161217
3,767220
3,767220
add a comment |
add a comment |
Thanks for contributing an answer to Mathematica Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f187334%2flist-interval-sum%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
is the length of the input list always a multiple of
n
? If not, what is the desired output for inputsRange[19]
andRange[20]
?$endgroup$
– kglr
Dec 5 '18 at 3:09
$begingroup$
The length of list will always be
Mod[Length[list],N] = 0
, so no worry about corner cases$endgroup$
– cj9435042
Dec 5 '18 at 3:13