login
The least significant nonzero digit in greedy A001563-base (A276326), a(0) = 0.
2

%I #8 Aug 31 2016 20:55:12

%S 0,1,2,3,1,1,2,3,2,1,2,3,3,1,2,3,4,1,1,1,2,3,1,1,2,3,2,1,2,3,3,1,2,3,

%T 4,1,2,1,2,3,1,1,2,3,2,1,2,3,3,1,2,3,4,1,3,1,2,3,1,1,2,3,2,1,2,3,3,1,

%U 2,3,4,1,4,1,2,3,1,1,2,3,2,1,2,3,3,1,2,3,4,1,5,1,2,3,1,1,1,1,2,3,1,1,2,3,2,1,2,3,3,1,2,3,4,1,1,1,2,3,1,1,2

%N The least significant nonzero digit in greedy A001563-base (A276326), a(0) = 0.

%H Antti Karttunen, <a href="/A276327/b276327.txt">Table of n, a(n) for n = 0..4320</a>

%F a(0) = 0; for n >= 1, if A276335(n) = 0 then a(n) = A276333(n), otherwise a(n) = a(A276335(n)).

%t f[n_] := Block[{a = {{0, n}}}, Do[AppendTo[a, {First@ #, Last@ #} &@ QuotientRemainder[a[[-1, -1]], (# #!) &[# - i]]], {i, 0, # - 1}] &@ NestWhile[# + 1 &, 0, (# #!) &[# + 1] <= n &]; Rest[a][[All, 1]]];

%t {0}~Join~Table[Last@ DeleteCases[f@ n, d_ /; d == 0], {n, 120}] (* _Michael De Vlieger_, Aug 31 2016 *)

%o (Scheme, two versions)

%o ;; Implemented with a loop:

%o (define (A276327 n) (let loop ((n n)) (let ((next_n (A276335 n))) (if (zero? next_n) (A276333 n) (loop next_n)))))

%o ;; As a recurrence:

%o (definec (A276327 n) (if (zero? n) n (if (zero? (A276335 n)) (A276333 n) (A276327 (A276335 n)))))

%Y Cf. A001563, A276326, A276333, A276335.

%K nonn,base

%O 0,3

%A _Antti Karttunen_, Aug 30 2016