As it says in the title I'm struggling with a problem: construct a Turing machine that decides the language $$L= \{a^n b^m |n,m ∈ \mathbb{N} \text{ and }m\%n=0 \text{ (n divisor of m)}\} $$
It's simple for $ a^n b^m $ but i don't know how to check if $m\%n=0$
If you do not want to mark letters, you could also delete the left most $a$ and move it right of the $b$s. On the way, delete one $b$. After $n$ steps you swapped the positions of $a$s and $b$s and are left with $n$ $a$s and $m-n$ $b$s. Now you take the rightmost $a$ and move it left etc. If there are no $b$s left check the following: If $nk = m$ the $a$s will be a connected block of letters, otherwise there will be space between them.