Does "scut work" contribution to a paper as a math undergrad carry weight in grad school application?
writing dozens of lines of code using Mathematica and helping my professor computing things

That sounds like normal undergraduate research to me.  It's probably not a menial contribution.  Very few people can write a dozen lines of Mathematica code.
If you do a good job, this could be a big help to your graduate school applications and even later career.