### 2.87 How to divide each element by its position in a list?

2.87.1 Mathematica
2.87.2 Maple
2.87.3 Matlab

Given $$A=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29]$$ change it to $[2,{\frac {3}{2}},{\frac {5}{3}},{\frac {7}{4}},{\frac {11}{5}},{\frac {13} {6}},{\frac {17}{7}},{\frac {19}{8}},{\frac {23}{9}},{\frac {29}{10}}]$

#### 2.87.1 Mathematica

A = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29};
MapIndexed[(#1/First[#2]) &, A]



$\left \{2,\frac {3}{2},\frac {5}{3},\frac {7}{4},\frac {11}{5},\frac {13}{6},\frac {17}{7},\frac {19}{8},\frac {23}{9},\frac {29}{10}\right \}$

#### 2.87.2 Maple

A:= [2, 3, 5, 7, 11, 13, 17, 19, 23, 29];
((x,y)->x/y)~(A,[seq(i,i=1..numelems(A))])

#or simpler might be to map the divsion operator directly

/ ~ (A,[seq(i,i=1..numelems(A))])



$[2,{\frac {3}{2}},{\frac {5}{3}},{\frac {7}{4}},{\frac {11}{5}},{\frac {13} {6}},{\frac {17}{7}},{\frac {19}{8}},{\frac {23}{9}},{\frac {29}{10}}]$

#### 2.87.3 Matlab

A=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29];
A./(1:length(A))



2.0000    1.5000    1.6667    1.7500    2.2000    2.1667    2.4286    2.3750    2.5556    2.9000