login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A247891 a(n) is Gray-coded in base 4 into n. 0
0, 1, 2, 3, 5, 6, 7, 4, 10, 11, 8, 9, 15, 12, 13, 14, 21, 22, 23, 20, 26, 27, 24, 25, 31, 28, 29, 30, 16, 17, 18, 19, 42, 43, 40, 41, 47, 44, 45, 46, 32, 33, 34, 35, 37, 38, 39, 36, 63, 60, 61, 62, 48, 49, 50, 51, 53, 54, 55, 52, 58, 59, 56, 57, 85, 86, 87, 84, 90 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
Permutation of nonnegative numbers.
LINKS
FORMULA
a(n) = n XOR4 [n/4] XOR4 [n/16] XOR4 [n/64] ... XOR4 [n/4^m] where m = [log(n)/log(4)], [x] is integer floor of x, and XOR4 is a base 4 analog of binary exclusive-OR operator.
PROG
(Python)
def basexor(a, b, base):
result = 0
digit = 1
while a or b:
da = a % base
db = b % base
a //= base
b //= base
sum = (da+db) % base
result += sum * digit
digit *= base
return result
base = 4 # 2 => A006068, 3 => A105529, 10 => A226134
for n in range(129):
a = n
b = n//base
while b:
a = basexor(a, b, base)
b //= base
print str(a)+', ',
CROSSREFS
Cf. A006068 (base 2), A105529 (base 3), A226134 (base 10).
Sequence in context: A339949 A160100 A371257 * A367407 A354370 A113821
KEYWORD
nonn,base
AUTHOR
Alex Ratushnyak, Sep 26 2014
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 20:33 EDT 2024. Contains 371916 sequences. (Running on oeis4.)