Advertisement
jukaukor

integers_to_graycode.jl

Feb 13th, 2023 (edited)
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. using GrayCode
  2. # pad=16 voi muuttaa pad=8 (8-bittiset) yms
  3. function gray(n) # tulosta graycode 1...n
  4. println("kokonaisluku bittijono graycode")
  5. for i = 1 : n
  6. println(i," ",transpose(digits(i, base=2, pad=16) |> reverse)," ",( @. bitstring(Gray8(i))))
  7. end
  8. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement