Skip to main content
Commonmark migration
Source Link

#Japt, 16 12 bytes

Japt, 16 12 bytes

@ZÔ¯V x}hVÆ1

Try it

@ZÔ¯V x}hVÆ1     :Implicit input of integers U=X & V=N
         VÆ1     :Map the range [0,V) returning 1 for each element
        h        :Push the result of the following to the array and repeat until its length equals U
@                :  Pass the array through the following function as Z
 ZÔ              :    Reverse Z
   ¯V            :    Slice to the Vth element
      x          :    Reduce by addition
       }         :  End function

#Japt, 16 12 bytes

@ZÔ¯V x}hVÆ1

Try it

@ZÔ¯V x}hVÆ1     :Implicit input of integers U=X & V=N
         VÆ1     :Map the range [0,V) returning 1 for each element
        h        :Push the result of the following to the array and repeat until its length equals U
@                :  Pass the array through the following function as Z
 ZÔ              :    Reverse Z
   ¯V            :    Slice to the Vth element
      x          :    Reduce by addition
       }         :  End function

Japt, 16 12 bytes

@ZÔ¯V x}hVÆ1

Try it

@ZÔ¯V x}hVÆ1     :Implicit input of integers U=X & V=N
         VÆ1     :Map the range [0,V) returning 1 for each element
        h        :Push the result of the following to the array and repeat until its length equals U
@                :  Pass the array through the following function as Z
 ZÔ              :    Reverse Z
   ¯V            :    Slice to the Vth element
      x          :    Reduce by addition
       }         :  End function
added 525 characters in body
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94

#Japt -h#Japt, 1616 12 bytes

Æ1
Nrn@ZÔ¯V ÆpUsNÎn)x}hVÆ1

Try itTry it

@ZÔ¯V x}hVÆ1     :Implicit input of integers U=X & V=N
         VÆ1     :Map the range [0,V) returning 1 for each element
        h        :Push the result of the following to the array and repeat until its length equals U
@                :  Pass the array through the following function as Z
 ZÔ              :    Reverse Z
   ¯V            :    Slice to the Vth element
      x          :    Reduce by addition
       }         :  End function

#Japt -h, 16 bytes

Æ1
Nrn ÆpUsNÎn)x

Try it

#Japt, 16 12 bytes

@ZÔ¯V x}hVÆ1

Try it

@ZÔ¯V x}hVÆ1     :Implicit input of integers U=X & V=N
         VÆ1     :Map the range [0,V) returning 1 for each element
        h        :Push the result of the following to the array and repeat until its length equals U
@                :  Pass the array through the following function as Z
 ZÔ              :    Reverse Z
   ¯V            :    Slice to the Vth element
      x          :    Reduce by addition
       }         :  End function
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94

#Japt -h, 16 bytes

Æ1
Nrn ÆpUsNÎn)x

Try it