GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • About
  • Ideas
  • Recent
  • Rankings
  • Wiki
  • Log In
  • MichalMarsalek
  • Prev
  • Random
  • Next
  • Restore solution
  • API
  • Discord
  • Feeds

This view

  • Original page
  • New address

GeezerVison is showing code.golf — Gray Code Encoder

Details

The reflected binary code (RBC), also known as Gray code, is an ordering of the binary numeral system such that two successive values differ in only one bit (binary digit).

For example, the representation of the decimal value 1 in binary would normally be 001 and 2 would be 010. In Gray code, these values are represented as 001 and 011. That way, incrementing a value from 1 to 2 requires only one bit to change, instead of two.

For each numeric argument in decimal form, print the same number in reflected binary (Gray code) form.

The numbers range from 0 to 4095 inclusive.

Variants: Gray Code Decoder

External links: Rosetta Code, Wikipedia

Compiled from AT&T syntax to x86-64 Linux. Use syscalls to write output.
05AB1E is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
APL is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Arturo is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Befunge is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
BQN is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
CJam is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
CoffeeScript is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Egel is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Fennel is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Harbour is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Hare is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Haxe is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Hush is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Hy is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Knight is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Lily is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Luau is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Odin is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Picat is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Qore is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Racket is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Rebol is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Rexx is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Scala is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Squirrel is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Stax is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Uiua is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Umka is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Vala is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Vyxal is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
ZuzuScript is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
ctrl + enter or

Errors

Copied

Arguments

Copied

Expected

Copied

Output

Copied

Diff

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.