I’m not a 100% sure I understood what you are trying, but here’s a way to increment a number in a odd-digit way:
function incr2!(v::AbstractVector{Int})
for i in reverse(eachindex(v))
v[i] = mod1(v[i]+2, 10)
if v[i] != 1
break
end
end
return v
end
julia> v = MVector(1,7,5)
3-element MVector{3, Int64} with indices SOneTo(3):
1
7
5
julia> incr2!(v)
3-element MVector{3, Int64} with indices SOneTo(3):
1
7
7
julia> incr2!(v)
3-element MVector{3, Int64} with indices SOneTo(3):
1
7
9
julia> incr2!(v)
3-element MVector{3, Int64} with indices SOneTo(3):
1
9
1