Skip to main content
Commonmark migration
Source Link

#Pyth, 8 bytes

Pyth, 8 bytes

m+F%Q>vz

Try it here!

#Pyth, 10 bytes

Pyth, 10 bytes

sMCc.[EZQQ

Try it here!

#Explanation

Explanation

###Explanation #1

Explanation #1

m+F%Q>vz   Full program. Q means input.

m          Map over the implicit range [0, input_1), with a variable d.
     >vz  All the elements of input_2 after d; input_2[d:] in Python.
   %Q     Every Qth element of ^.
 +F       Sum. Implicitly output the result.

###Explanation #2

Explanation #2

sMCc.[EZQQ   Full program.

    .[E      Pad the second input to the right, with repeated copies of...
       Z     ... Zero (0), up to the nearest multiple of...
        Q    ... The first input.
   c     Q   Chop into chunks of length equal to the first input.
  C          Matrix transpose. Get all the columns of the nested list.
sM           Sum each.
             Output (implicitly). 

#Pyth, 8 bytes

m+F%Q>vz

Try it here!

#Pyth, 10 bytes

sMCc.[EZQQ

Try it here!

#Explanation

###Explanation #1

m+F%Q>vz   Full program. Q means input.

m          Map over the implicit range [0, input_1), with a variable d.
     >vz  All the elements of input_2 after d; input_2[d:] in Python.
   %Q     Every Qth element of ^.
 +F       Sum. Implicitly output the result.

###Explanation #2

sMCc.[EZQQ   Full program.

    .[E      Pad the second input to the right, with repeated copies of...
       Z     ... Zero (0), up to the nearest multiple of...
        Q    ... The first input.
   c     Q   Chop into chunks of length equal to the first input.
  C          Matrix transpose. Get all the columns of the nested list.
sM           Sum each.
             Output (implicitly). 

Pyth, 8 bytes

m+F%Q>vz

Try it here!

Pyth, 10 bytes

sMCc.[EZQQ

Try it here!

Explanation

Explanation #1

m+F%Q>vz   Full program. Q means input.

m          Map over the implicit range [0, input_1), with a variable d.
     >vz  All the elements of input_2 after d; input_2[d:] in Python.
   %Q     Every Qth element of ^.
 +F       Sum. Implicitly output the result.

Explanation #2

sMCc.[EZQQ   Full program.

    .[E      Pad the second input to the right, with repeated copies of...
       Z     ... Zero (0), up to the nearest multiple of...
        Q    ... The first input.
   c     Q   Chop into chunks of length equal to the first input.
  C          Matrix transpose. Get all the columns of the nested list.
sM           Sum each.
             Output (implicitly). 
deleted 88 characters in body
Source Link
Mr. Xcoder
  • 42.5k
  • 9
  • 81
  • 214

#Pyth, 8 bytes

m+F%Q>vz

Try it here!

#Pyth, 10 bytes

sMCc.[EZQQ

Try it here!

#Explanation

###Explanation #1

m+F%Q>vz   Full program. Q means input.

m          Map over the implicit range [0, input_1), with a variable d.
     >vz  All the elements of input_2 after d; input_2[d:] in Python.
   %Q     Every Qth element of ^.
 +F       Sum. Implicitly output the result.

###Explanation #2

sMCc.[EZQQ   Full program.

    .[E      Pad the second input to the right, with repeated copies of...
       Z     ... Zero (0), up to the nearest multiple of...
        Q    ... The first input.
   c     Q   Chop into chunks of length equal to the first input.
  C          Matrix transpose. Get all the columns of the nested list.
sM           Sum each.
             Output (implicitly). 

#Pyth, 8 bytes

m+F%Q>vz

Try it here!

A bit out-dated explanation

ms|%Q>vzdZ   Full program. Q means input.

m            Map over the implicit range [0, input_1), with a variable d.
     >vzd    All the elements of input_2 after d; input_2[d:] in Python.
   %Q        Every Qth element of ^.
  |      Z   Logical OR with 0 (to handle an empty array after trimming).
 s           Sum. Implicitly output the result.

#Pyth, 10 bytes

sMCc.[EZQQ

Try it here!

#Explanation

sMCc.[EZQQ   Full program.

    .[E      Pad the second input to the right, with repeated copies of...
       Z     ... Zero (0), up to the nearest multiple of...
        Q    ... The first input.
   c     Q   Chop into chunks of length equal to the first input.
  C          Matrix transpose. Get all the columns of the nested list.
sM           Sum each.
             Output (implicitly). 

#Pyth, 8 bytes

m+F%Q>vz

Try it here!

A bit out-dated explanation

ms|%Q>vzdZ   Full program. Q means input.

m            Map over the implicit range [0, input_1), with a variable d.
     >vzd    All the elements of input_2 after d; input_2[d:] in Python.
   %Q        Every Qth element of ^.
  |      Z   Logical OR with 0 (to handle an empty array after trimming).
 s           Sum. Implicitly output the result.

#Pyth, 8 bytes

m+F%Q>vz

Try it here!

#Pyth, 10 bytes

sMCc.[EZQQ

Try it here!

#Explanation

###Explanation #1

m+F%Q>vz   Full program. Q means input.

m          Map over the implicit range [0, input_1), with a variable d.
     >vz  All the elements of input_2 after d; input_2[d:] in Python.
   %Q     Every Qth element of ^.
 +F       Sum. Implicitly output the result.

###Explanation #2

sMCc.[EZQQ   Full program.

    .[E      Pad the second input to the right, with repeated copies of...
       Z     ... Zero (0), up to the nearest multiple of...
        Q    ... The first input.
   c     Q   Chop into chunks of length equal to the first input.
  C          Matrix transpose. Get all the columns of the nested list.
sM           Sum each.
             Output (implicitly). 
added 26 characters in body
Source Link
Mr. Xcoder
  • 42.5k
  • 9
  • 81
  • 214

#Pyth, 10 bytes

sMCc.[EZQQ

Try it here!

#Explanation

sMCc.[EZQQ   Full program.

    .[E      Pad the second input to the right, with repeated copies of...
       Z     ... Zero (0), up to the nearest multiple of...
        Q    ... The first input.
   c     Q   Chop into chunks of length equal to the first input.
  C          Matrix transpose. Get all the columns of the nested list.
sM           Sum each.
             Output (implicitly). 

#Pyth, 108 bytes

ms|%Q>vzdZm+F%Q>vz

Try it here!Try it here!

A bit out-dated explanation

ms|%Q>vzdZ   Full program. Q means input.

m            Map over the implicit range [0, input_1), with a variable d.
     >vzd    All the elements of input_2 after d; input_2[d:] in Python.
   %Q        Every Qth element of ^.
  |      Z   Logical OR with 0 (to handle an empty array after trimming).
 s           Sum. Implicitly output the result.

#Pyth, 10 bytes

sMCc.[EZQQ

Try it here!

#Explanation

sMCc.[EZQQ   Full program.

    .[E      Pad the second input to the right, with repeated copies of...
       Z     ... Zero (0), up to the nearest multiple of...
        Q    ... The first input.
   c     Q   Chop into chunks of length equal to the first input.
  C          Matrix transpose. Get all the columns of the nested list.
sM           Sum each.
             Output (implicitly). 

#Pyth, 10 bytes

ms|%Q>vzdZ

Try it here!

ms|%Q>vzdZ   Full program. Q means input.

m            Map over the implicit range [0, input_1), with a variable d.
     >vzd    All the elements of input_2 after d; input_2[d:] in Python.
   %Q        Every Qth element of ^.
  |      Z   Logical OR with 0 (to handle an empty array after trimming).
 s           Sum. Implicitly output the result.

#Pyth, 10 bytes

sMCc.[EZQQ

Try it here!

#Explanation

sMCc.[EZQQ   Full program.

    .[E      Pad the second input to the right, with repeated copies of...
       Z     ... Zero (0), up to the nearest multiple of...
        Q    ... The first input.
   c     Q   Chop into chunks of length equal to the first input.
  C          Matrix transpose. Get all the columns of the nested list.
sM           Sum each.
             Output (implicitly). 

#Pyth, 8 bytes

m+F%Q>vz

Try it here!

A bit out-dated explanation

ms|%Q>vzdZ   Full program. Q means input.

m            Map over the implicit range [0, input_1), with a variable d.
     >vzd    All the elements of input_2 after d; input_2[d:] in Python.
   %Q        Every Qth element of ^.
  |      Z   Logical OR with 0 (to handle an empty array after trimming).
 s           Sum. Implicitly output the result.
added 1 character in body
Source Link
Mr. Xcoder
  • 42.5k
  • 9
  • 81
  • 214
Loading
added 1 character in body
Source Link
Mr. Xcoder
  • 42.5k
  • 9
  • 81
  • 214
Loading
deleted 13 characters in body
Source Link
Mr. Xcoder
  • 42.5k
  • 9
  • 81
  • 214
Loading
Source Link
Mr. Xcoder
  • 42.5k
  • 9
  • 81
  • 214
Loading