Material banding effect based on distance

I have created a material that creates a rainbow effect by lerping between 3 colors based on local position. The material blueprint is shown below.

And the effect looks like this

I would like to modify the material so that the rainbow pattern repeats based on distance (i.e. the rainbow repeats every 5 meters). The current banding in place only repeats the banding pattern a set number of times (i.e. if banding=8, the pattern repeats only 8 times).

Any suggestions would be of great help!

I made this. It’s not right by a long way, but the concept I was trying to get across was that of repeatedly dividing distance from the origin to get the banding:

3 color version:

Thanks for your input! I’ll try it out your suggestion. It looks like it might work for my project