OFFSET
0,3
COMMENTS
A028897(n) is the result of using the decimal digits of n, but weighting their position as in base 2. For sake of brevity we refer to this as the b-value of n in the sequel. This idea is found on the website given in links under the name "decibinary numbers".
The b-values increment by 1 at indices (of "records") 1, 2, 4, 6, 10, 14, 20, 26, 36, ... Prefixing an initial 0, the gaps between these, equal to the number of occurrences of a given b-value (0, 1, 2, ...), are 1, 1, 2, 2, 4, 4, 6, 6, 10, 10, 13, 13, ... = A072170(n,10). In this sequence each of (1, 2, 4, 6, 10, 13, 18, ...) is repeated twice.
LINKS
Robert Israel, Table of n, a(n) for n = 0..10000
Robin C. Yu, Decibinary Numbers, on Hackerrank.com.
EXAMPLE
The first terms of the sequence are as follows: (b = A028897)
n | 0 | 1 | 2 | 10 | 3 | 11 | 4 | 12 | 20 | 100 | 5 | 13 | 21 | 101 | ...
----+---+---+---+----+---+----+---+----+----+-----+---+----+----+-----+-----
b(n)| 0 | 1 | 2 | 2 | 3 | 3 | 4 | 4 | 4 | 4 | 5 | 5 | 5 | 5 | ...
For example, b(345) = 3*2^2 + 4*2 + 5 = 25.
MAPLE
N:= 30: # for all numbers with A028897(n) <= N
L:= {seq([i, i], i=0..9)}: Agenda:= {seq([i, i], i=1..9)}:
extend:= proc(p) local x; op(select(t -> t[2]<=N, [seq([10*p[1]+x, 2*p[2]+x], x=0..9)])); end proc:
sorter:= proc(p1, p2) if p1[2] <> p2[2] then p1[2] < p2[2] else p1[1] < p2[1] fi end proc:
while Agenda <> {} do
Agenda:= map(extend, Agenda);
L:= L union Agenda;
od:
L:= sort( convert(L, list), sorter):
map(t -> t[1], L); # Robert Israel, Feb 24 2019
PROG
CROSSREFS
KEYWORD
AUTHOR
M. F. Hasler, Feb 13 2019
STATUS
approved