[Question]
  [
**A simple one:**
Take a list of positive integers as input and output the numbers modulus their 1-based index in the list.
If the input integers are `{a, b, c, d, e, f, g}` then the output should be `{a%1, b%2, c%3, d%4, e%5, f%6, g%7}` where `%` is the modulus operator.
---
**Test cases:**
```
10  9  8  7  6  5  4  3  2  1
 0  1  2  3  1  5  4  3  2  1
8 18  6 11 14  3 15 10  6 19 12  3  7  5  5 19 12 12 14  5
0  0  0  3  4  3  1  2  6  9  1  3  7  5  5  3 12 12 14  5
1
0
1  1
0  1
```
  
[Answer]
# [Haskell](https://www.haskell.org/), 20 bytes
```
($[1..]).zipWith mod
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P81WQyXaUE8vVlOvKrMgPLMkQyE3P@V/bmJmnoKtQkFRZl6JgopCmkK0oYGOpY6FjrmOmY6pjomOsY6RjmHsfwA "Haskell – Try It Online")
A trick to `flip` I learned from [a golf of Anders Kaseorg](https://codegolf.stackexchange.com/a/83883/20260).
[Answer]
# [Operation Flashpoint](https://en.wikipedia.org/wiki/Operation_Flashpoint:_Cold_War_Crisis) scripting language, 73 bytes
```
f={l=_this;r=[];i=0;while{i<count l}do{r=r+[(l select i)%(i+1)];i=i+1};r}
```
**Call with:**
```
numList = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1];
hint format["%1\n%2", numList, numList call f];
```
**Output:**
[![](https://i.stack.imgur.com/Iu37K.jpg)](https://i.stack.imgur.com/Iu37K.jpg)
[Answer]
# [Python 2](https://docs.python.org/2/), 35 bytes
```
i=1
for x in input():print x%i;i+=1
```
[Try it online!](https://tio.run/##DcI7CoAwEAXA3lO8RlB8hRv/Sk4ituI2SZAI8fTRYcIbL@9MzmqlOP2NBHX/8MSqXsOtLiKVumljJeddWmIhZmIiRmIgeqIjDCHHBw "Python 2 – Try It Online")
Counts the index up manually, as per [a tip of mine](https://codegolf.stackexchange.com/a/40791/20260).
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 2 bytes
```
%J
```
[Try it online!](https://tio.run/##y0rNyan8/1/V6////9GGBjoKCpZAbAHE5kBsBsSmQGwCxMZAbATEhrEA "Jelly – Try It Online")
**Explanation:**
```
%J
 J List 1 .. len(input). This is results in a list of the indexes.
%  Modulo.
```
Basically, the code modulos the original list by the list of indexes.
[Answer]
# R, ~~24~~ 18 bytes
```
pryr::f(x%%seq(x))
```
Evaluates to the function:
```
function (x) 
x%%seq(x)
```
Which uses `seq_along()` to create a vector of the same length as `x`, starting at 1, and then `%%` to take the modulo.
Default behaviour of `seq` when presented with a vector is `seq(along.with = x)` which is the same output as `seq_along(x)`, but 6 bytes shorter.
[Answer]
# R, 27 bytes
```
x=scan();cat(x%%1:sum(1|x))
```
saved 5 bytes thanks to @Jarko
saved 4 more thanks to @Giuseppe
saved 2 more thanks to @Taylor Scott
Saved 2 more thanks to @returnbull
[Answer]
# [MATL](https://github.com/lmendo/MATL), ~~4~~, 3 bytes
```
tf\
```
[Try it online!](https://tio.run/##BcG5AYAgEACwVTKCgPLMohY2VNqx/5l8z3oj1rwizrQx6DQqBzuFTLp/ "MATL – Try It Online")
*One byte saved thanks to @LuisMendo!*
[Answer]
# [APL (Dyalog)](https://www.dyalog.com/), 5 bytes
```
⍳∘≢|⊢
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///P@1R24RHvZsfdcx41Lmo5lHXIqCQgqGBgoKlgoKFgoK5goKZgoKpgoKJgoKxgoKRgoIhVxpQwtACJGFoqGAIljA0BesBilgqGBqBlZqDtZlCRUAIqNIUqBlkAFAfAA "APL (Dyalog Unicode) – Try It Online")
`⍳` the indices
`∘` of
`≢` the length of the argument
`|` that modulus
`⊢` the argument
[Answer]
# [Cubix](https://github.com/ETHproductions/cubix), 19 bytes
```
;ww.1I!@s%Ow;)Sow.$
```
[Try it online!](https://tio.run/##Sy5Nyqz4/9@6vFzP0FPRoVjVv9xaMzi/XE/l/38LBUMLBQUzBUNDBUMTBQVjBUNTBUMDsIilgqERSETBXEHBFIQgIiAEVGkKAA "Cubix – Try It Online")
```
    ; w
    w .
1 I ! @ s % O w
; ) S o w . $ .
    . .
    . .
```
[Watch It Run](https://ethproductions.github.io/cubix/?code=ICAgIDsgdwogICAgdyAuCjEgSSAhIEAgcyAlIE8gdwo7ICkgUyBvIHcgLiAkIC4KICAgIC4gLgogICAgLiAuCg==&input=OCAxOCAgNiAxMSAxNCAgMyAxNSAxMCAgNiAxOSAxMiAgMyAgNyAgNSAgNSAxOSAxMiAxMiAxNCAgNQ==&speed=10)
A fairly straight forward implementation.
* `1` push 1 to the stack to start the index
* `I!@` get the integer input and halt if 0
* `s%Ow` swap the index up, mod, output result and change lane
* `;)` remove result and increment index
* `Sow` push 32, output space and change lane (heading down from o)
* `$O` jump the output
* `w;w` change lange, remove 32 from stack and change lane onto the `I` input
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 2 bytes
```
ā%
```
[Try it online!](https://tio.run/##MzBNTDJM/f//SKPq///RFjqGFjpmOoaGOoYmOsY6hqY6hgYgvqWOoRGQb65jCoQQHgiZ6JjGAgA "05AB1E – Try It Online") or [Try all tests](https://tio.run/##LYvBDYAgEASr8TcPFzmBWggPTWzBhKe92Rceicl@ZjOz2nHqGnfv432WwahVK4VMYseIbATUqBllvyQ0TxkuOhcUnJPL9tNcxDyaoQetfQ "05AB1E – Try It Online")
```
ā  # Push the range(1, len(a) + 1)
 % # Mod each element in the input by the same one in this list
```
[Answer]
## Mathematica, 22 bytes
```
#&@@@Mod~MapIndexed~#&
```
One more Mathematica approach.
[Answer]
# [Starry](https://esolangs.org/wiki/Starry), ~~75~~ 70 bytes
```
      +`  , + +   *    +  + +      +*   +    *  .               + + .'
```
[Try it online!](https://tio.run/##VYpBEoAgDAPveUVuzoDDWAXF3@gX0IuvrxS8mOTQTXrdZymPKpv8QY701aRrBT@y2/WiTYF/2VcYVDMkY4UIJGKBJMhkvEPmyhtSdSdLRHoB)
### Explanation
This is an infinite loop that keeps reading numbers from the input and increasing a counter initiallized at `1`. For each pair of input and counter, the modulus is computed and printed.
To end the loop when input has been exhausted, the following trick is used. When no more input is available, trying to read one more number gives a `0`. Thus, we divide the read number by itself, and if it is `0` the program ends with an error. Else we discard the result and continue.
```
      +              Push 1. This is the initial value of the counter
`                    Mark label
  ,                  Read number from input and push it. Gives 0 if no more input
 +                   Duplicate top of the stack
 +                   Duplicate top of the stack
   *                 Pop two numbers and push their division. Error if divisor is 0
    +                Pop (discard) top of the stack
  +                  Swap top two numbers
 +                   Duplicate top of the stack
      +              Push 1
*                    Pop two numbers and push their sum. This increases the counter
   +                 Rotate stack down, to move increased counter to bottom
    *                Pop two numbers and push their modulus
  .                  Pop a number and print it as a number
               +     Push 10
 +                   Duplicate top of the stack
 .                   Pop a number (10) and print it as ASCII character (newline)
'                    If top of the stack is non-zero (it is, namely 10) go to label
```
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 9 bytes
```
l⟦₁;?↔z%ᵐ
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r/P@fR/GWPmhqt7R@1TalSfbh1wv//0YYGOpY6FjrmOmY6pjomOsY6RjqGsf@jAA "Brachylog – Try It Online")
### Explanation
```
l⟦₁          [1, ..., length(Input)]
   ;?↔z      Zip the Input with that range
       %ᵐ    Map mod
```
[Answer]
# R, 22 bytes
```
pryr::f(x%%1:sum(x|1))
```
R performs 1:length(x) before doing the modulus.
[Answer]
# [Itr](https://github.com/bsoelch/OneChar.js/blob/main/ItrLang.md), 5 bytes
`#äL¹%`
[online interpreter](https://bsoelch.github.io/OneChar.js/?lang=Itr&src=I-RMuSU=&in=KDEwICA5ICA4ICA3ICA2ICA1ICA0ICAzICAyICAxKQ==)
# Explanation
```
#     ; read the list from standard input
 äL   ; push its length
   ¹  ; converted to 1-based range
    % ; point-wise modulo
      ; implicitly output list
```
---
# Itr, [4 bytes](https://bsoelch.github.io/OneChar.js/?lang=Itr&src=I0y5JQ==&in=KDEwICA5ICA4ICA3ICA2ICA1ICA0ICAzICAyICAxKQ==)
`#L¹%`
The `ä` before the `L` is no-longer necessary in newer versions
[Answer]
# [Japt](https://github.com/ETHproductions/japt) [`-m`](https://codegolf.meta.stackexchange.com/a/14339/), ~~5~~ ~~4~~ 3 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
uVÄ
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LW0&code=dVbE&input=WzEwIDmgOKA3oDagNaA0oDOgMiAxXQ)
-1 byte thanks to [ETHproductions](https://codegolf.stackexchange.com/users/42545/ethproductions)
[Answer]
# [Python 2](https://docs.python.org/2/), 42 bytes
```
lambda l:[v%(i+1) for i,v in enumerate(l)]
```
[Try it online!](https://tio.run/##BcHLCoQgAAXQX7mbAWXuInsXzJdUCyMlwSzEgvl6O@f6p/0MZba/OXt9rJuGH6fnI9xXSdgzwvGBCzDhPkzUyQgvl3xFFxKsmFRBDERPdERLNERNVERJqEXmFw "Python 2 – Try It Online")
[Answer]
## Haskell, 22 bytes
```
zipWith(flip mod)[1..]
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P822KrMgPLMkQyMtJ7NAITc/RTPaUE8v9n9uYmaegq1CQVFmXomCikKaQrShgY6ljoWOuY6ZjqmOiY6xjpGOYex/AA "Haskell – Try It Online")
Also: `flip(zipWith mod)[1..]`.
[Answer]
# Mathematica, 21 bytes
```
#~Mod~Range@Length@#&
```
[Try it online!](https://tio.run/##y00sychMLv6fZvtfuc43P6UuKDEvPdXBJzUvvSTDQVntf0BRZl6JQ5qCQ7WFjoIhEJsBKUMgNtFRMAZSpkBsABG1BGIjsKi5joIpGMHEwBiow7T2PwA "Mathics – Try It Online")
or **20 bytes** (by Martin)
```
#~Mod~Range@Tr[1^#]&
```
[Answer]
# Excel VBA, ~~59~~ 46 Bytes
### Golfed
Anonymous VBE Immediate window funtion that takes a space () delimited array string as input from range `[A1]` and output the numbers modulus their 1-based index in the starting list to the VBE immediate window
```
For Each n In Split([A1]):i=i+1:?n Mod i;:Next
```
Input / Output: 
```
[A1]="10 9 8 7 6 5 4 3 2 1" ''# or manually set the value
For Each n In Split([A1]):i=i+1:?n Mod i;:Next
 0  1  2  3  1  5  4  3  2  1 
```
### Old `Sub`routine version
Subroutine that takes input as a passed array and outouts to the VBE immediate window.
```
Sub m(n)
For Each a In n
i=i+1
Debug.?a Mod i;
Next
End Sub
```
Input / Ouput:
```
m Array(10,9,8,7,6,5,4,3,2,1)
 0  1  2  3  1  5  4  3  2  1 
```
### Ungolfed
```
Option Private Module
Option Compare Binary
Option Explicit
Option Base 0 ''# apparently Option Base 1 does not work with ParamArrays
Public Sub modIndex(ParamArray n() As Variant)
    Dim index As Integer
    For index = LBound(n) To UBound(n)
        Debug.Print n(index) Mod (index + 1);
    Next index
End Sub
```
Input / Output:
```
Call modIndex(10,9,8,7,6,5,4,3,2,1)
 0  1  2  3  1  5  4  3  2  1 
```
[Answer]
# [Thunno 2](https://github.com/Thunno/Thunno2), 2 [bytes](https://github.com/Thunno/Thunno2/blob/main/docs/codepage.md)
```
ż%
```
[Try it online!](https://Not-Thonnu.github.io/run?code=%C5%BC%25&input=%5B10%2C%209%2C%208%2C%207%2C%206%2C%205%2C%204%2C%203%2C%202%2C%201%5D&flags=)
#### Explanation
```
ż%  # Implicit input
 $  # Vectorised modulo
ż   # List [1..length]
    # Implicit output
```
[Answer]
# Rust, 46 bytes
```
|v|v.iter().zip(1..).map(|(n,i)|n%i).collect()
```
[Rust Playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&code=fn+main%28%29+%7B%0A++++let+solution%3A+fn%28%26%5Busize%5D%29+-%3E+Vec%3Cusize%3E+%3D+%7Cv%7C+v.iter%28%29.zip%281..%29.map%28%7C%28n%2C+i%29%7C+n+%25+i%29.collect%28%29%3B%0A++++%2F%2F+%7Cv%7Cv.iter%28%29.zip%281..%29.map%28%7C%28n%2Ci%29%7Cn%25i%29.collect%28%29%0A%0A++++assert_eq%21%28%0A++++++++solution%28%26%5B10%2C+9%2C+8%2C+7%2C+6%2C+5%2C+4%2C+3%2C+2%2C+1%5D%29%2C%0A++++++++vec%21%5B0%2C+1%2C+2%2C+3%2C+1%2C+5%2C+4%2C+3%2C+2%2C+1%5D%0A++++%29%3B%0A%0A++++assert_eq%21%28%0A++++++++solution%28%26%5B8%2C+18%2C+6%2C+11%2C+14%2C+3%2C+15%2C+10%2C+6%2C+19%2C+12%2C+3%2C+7%2C+5%2C+5%2C+19%2C+12%2C+12%2C+14%2C+5%5D%29%2C%0A++++++++vec%21%5B0%2C+0%2C+0%2C+3%2C+4%2C+3%2C+1%2C+2%2C+6%2C+9%2C+1%2C+3%2C+7%2C+5%2C+5%2C+3%2C+12%2C+12%2C+14%2C+5%5D%2C%0A++++%29%3B%0A%0A++++assert_eq%21%28solution%28%26%5B1%5D%29%2C+vec%21%5B0%5D%29%3B%0A%0A++++assert_eq%21%28solution%28%26%5B1%2C+1%5D%29%2C+vec%21%5B0%2C+1%5D%29%3B%0A%7D%0A)
[Answer]
# [CJam](https://sourceforge.net/p/cjam), 9 bytes
```
{_,,:).%}
```
Anonymous block that expects an array on the stack and replaces it by the output array.
[**Try it online!**](https://tio.run/##S85KzP0fbaFgaKGgYKZgaKhgaKKgYKxgaKpgaAAWsVQwNAKJKJgrKJiCEEQEhIAqTWP/V8fr6Fhp6qnW/q8r@A8A "CJam – Try It Online")
### Explanation
```
{       }    e# Define block
 _           e# Duplicate
  ,          e# Length
   ,         e# Range, 0-based
    :)       e# Add 1 to each entry
      .%     e# Vectorized modulus
```
[Answer]
# J, 9 bytes
```
>:@i.@#|[
```
1 ... n | original list
`|` is mod
[Answer]
# JavaScript (ES6), 22 bytes
```
a=>a.map((x,y)=>x%++y)
```
[Answer]
# AWK, 13
```
{print $1%NR}
```
[Try it online](https://tio.run/##SyzP/v@/uqAoM69EQcVQ1S@o9v9/QwMuSy4LLnMuMy5TLhMuYy4jLkMA).
[Answer]
# tcl, 35
```
lmap l $L {puts [expr $l%[incr i]]}
```
## [demo](http://rextester.com/UVQG28963)
[Answer]
# GNU APL 1.2, 9 bytes
```
(⍳⍴R)|R←⎕
```
APL operates from right to left, hence the parentheses.
`R←⎕` assigns user input to vector `R`.
`⍴R` gives the length of the vector; `⍳⍴R` gives a vector with all numbers from 1 to that length (so the indices).
`|` is the mod operator (`a|b` yields `b%a`). APL operates on arrays, so the code snippet a vector containing each element from the user's input mod its index.
[Answer]
# [Pari/GP](http://pari.math.u-bordeaux.fr/), 22 bytes
```
a->[a[n]%n|n<-[1..#a]]
```
[Try it online!](https://tio.run/##LYvBCsIwEER/ZakIDUyKWxubgPZHwh72UilICKUXwX@PiQh7mDezL@u@2WcuKz2oqF2ixiTn9El3G3kYTipSNOfXu1eyC@V9S0eNXYOO1l6NAcXIFwR4zLjBYcIVI1jq4MG@dszg1rIDh8YBPFae67f7U7upOT@xCiKmfAE "Pari/GP – Try It Online")
[Answer]
# Pyth, 5
```
.e%bh
```
[Online test](https://pyth.herokuapp.com/?code=.e%25bh&input=%5B10%2C%209%2C%208%2C%207%2C%206%2C%205%2C%204%2C%203%2C%202%2C%201%5D&debug=0).
```
    hk     # 1-based index of (implicit) lambda variable
   b       # element
  %        # element mod (1-based index)
.e    Q    # enumerated map over (implicit) input
```
]