OFFSET
0,3
COMMENTS
An irregular table in which the n-th row lists the base-7 digits of n. - Jason Kimberley, Dec 07 2012
The base-7 Champernowne constant: it is normal in base 7. - Jason Kimberley, Dec 07 2012
MATHEMATICA
Flatten[IntegerDigits[#, 7]&/@Range[0, 60]] (* Harvey P. Dale, Mar 04 2011 *)
almostNatural[n_, b_] := Block[{m = 0, d = n, i = 1, l, p}, While[m <= d, l = m; m = (b - 1) i*b^(i - 1) + l; i++]; i--; p = Mod[d - l, i]; q = Floor[(d - l)/i] + b^(i - 1); If[p != 0, IntegerDigits[q, b][[p]], Mod[q - 1, b]]]; Array[ almostNatural[#, 7] &, 105, 0] (* Robert G. Wilson v, Jun 29 2014 *)
PROG
(Magma) [0]cat &cat[Reverse(IntegerToSequence(n, 7)):n in[1..31]]; // Jason Kimberley, Dec 07 2012
(Python)
from itertools import count, chain, islice
from sympy.ntheory.factor_ import digits
def A030998_gen(): return chain.from_iterable(digits(m, 7)[1:] for m in count(0))
(Python)
from gmpy2 import digits
from oeis_sequences.OEISsequences import bisection, bsearch
def A030998(n):
if n == 0: return 0
def g(x): return x+(m:=len(digits(x, 7)))*(x+1)-7*(7**(m-1)-1)//6
def f(x): return n+1+bsearch(g, x)
return int((s:=digits(a:=bisection(f, n+1, n+1)-n, 7))[n-1-a*(k:=len(s))+(7**k-1)//6]) # Chai Wah Wu, Mar 02 2026
CROSSREFS
KEYWORD
AUTHOR
STATUS
approved
