cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A305493 A binary encoding of the decimal representation of a number: for any number n >= 0, consider its decimal representation and replace each 9 with "111111111" and each other digit d with a "0" followed by d "1"s and interpret the result as a binary string.

This page as a plain text file.
%I A305493 #23 Feb 27 2020 23:24:39
%S A305493 0,1,3,7,15,31,63,127,255,511,2,5,11,23,47,95,191,383,767,1023,6,13,
%T A305493 27,55,111,223,447,895,1791,2047,14,29,59,119,239,479,959,1919,3839,
%U A305493 4095,30,61,123,247,495,991,1983,3967,7935,8191,62,125,251,503,1007,2015
%N A305493 A binary encoding of the decimal representation of a number: for any number n >= 0, consider its decimal representation and replace each 9 with "111111111" and each other digit d with a "0" followed by d "1"s and interpret the result as a binary string.
%C A305493 This sequence is a permutation of the nonnegative numbers.
%C A305493 The inverse sequence, say b, satisfies b(n) = A001202(n+1) for n = 0..1022, but b(1023) = 19 whereas A001202(1024) = 10.
%C A305493 The first known fixed points are: 0, 1, 65010; they all belong to A037308.
%C A305493 This encoding can be applied to any base b > 1 (when b = 2, we obtain the identity function) as well as to the factorial base and to the primorial base.
%H A305493 Rémy Sigrist, <a href="/A305493/b305493.txt">Table of n, a(n) for n = 0..10000</a>
%H A305493 Rémy Sigrist, <a href="/A305493/a305493.png">Colored logarithmic scatterplot of the first 1000000 terms</a> (where the color is function of the digital sum minus the number of nonleading digits different from 9)
%H A305493 <a href="/index/De#decimal_expansion">Index entries for sequences related to decimal expansion of n</a>
%H A305493 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A305493 A000120(a(n)) = A007953(n).
%F A305493 a(A051885(k)) = 2^k - 1 for any k >= 0.
%F A305493 a(A002275(k)) = A002450(k) for any k >= 0.
%F A305493 a(10 * n) = 2 * a(n).
%e A305493 For n = 1972:
%e A305493 - the digit 1 is replaced by "01",
%e A305493 - the digit 9 is replaced by "111111111",
%e A305493 - the digit 7 is replaced by "01111111",
%e A305493 - the digit 2 is replaced by "011",
%e A305493 - hence we obtain the binary string "0111111111101111111011",
%e A305493 - and a(1972) = 2096123.
%t A305493 tb=Table[n->PadRight[{0},n+1,1],{n,9}]/.PadRight[{0},10,1]-> PadRight[ {},9,1]; Table[FromDigits[IntegerDigits[n]/.tb//Flatten,2],{n,0,60}] (* _Harvey P. Dale_, Jul 31 2018 *)
%o A305493 (PARI) a(n, base=10) = my (b=[], d=digits(n, base)); for (i=1, #d, if (d[i]!=base-1, b=concat(b, 0)); b=concat(b, vector(d[i], k, 1))); fromdigits(b, 2)
%o A305493 /* inverse */ b(n, base=10) = my (v=0, p=1); while (n, my (d = min(valuation(n+1, 2), base-1)); v += p * d; n \= 2^min(base-1, 1+d); p *= base); v
%Y A305493 Cf. A000120, A001202, A002275, A002450, A007953, A037308, A051885.
%K A305493 nonn,base,easy
%O A305493 0,3
%A A305493 _Rémy Sigrist_, Jun 02 2018