You want 8n ≤ x < 8(n+1), where n = 1, 2, 3, ...
I can't think of an elegant function, but I can think of a procedure. To get n, divide x by 8 and drop the remainder (or truncate the quotient). Using your example, 13/8 = 1 remainder 5. n, then, is equal to 1 and 8*1 = 8. Here are a few other examples:
x n 8*n
25 25/8 = 3 rem 1 8*3= 24
47 47/8 = 5 rem 7 8*5= 40
259 259/8 = 32 rem 3 8*32= 256
Hope that helps.