login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A339012
Written in factorial base, n ends in a(n) consecutive non-0 digits.
3
0, 1, 0, 2, 0, 2, 0, 1, 0, 3, 0, 3, 0, 1, 0, 3, 0, 3, 0, 1, 0, 3, 0, 3, 0, 1, 0, 2, 0, 2, 0, 1, 0, 4, 0, 4, 0, 1, 0, 4, 0, 4, 0, 1, 0, 4, 0, 4, 0, 1, 0, 2, 0, 2, 0, 1, 0, 4, 0, 4, 0, 1, 0, 4, 0, 4, 0, 1, 0, 4, 0, 4, 0, 1, 0, 2, 0, 2, 0, 1, 0, 4, 0, 4, 0, 1, 0
OFFSET
0,4
COMMENTS
Also, a(n) is the least p for which n mod (p+2)! < (p+1)!. A small remainder like this means a 0 digit at position p in the factorial base representation of n, where the least significant digit is position p=0. The least such p means only nonzero digits below.
Those n with a(n)=p are characterized by remainders n mod (p+2)!, per the formula below. These remainders are terms of A227157 which is factorial base digits all nonzero. A227157 can be taken by rows where row p lists the terms having p digits in factorial base. Each digit ranges from 1 up to 1,2,3,... respectively so there are p! values in a row, and so the asymptotic density of terms p here is p!/(p+2)! = 1/((p+2)*(p+1)) = 1/A002378(p+1) = 1/2, 1/6, etc.
The smallest n with a(n)=p is the factorial base repunit n = 11..11 with p 1's = A007489(p).
FORMULA
a(n)=p iff n mod (p+2)! is a term in row p of A227157 (row p terms having p digits), including p=0 by reckoning an initial A227157(0) = 0 as no digits.
a(n)=0 iff n mod 2 = 0.
a(n)=1 iff n mod 6 = 1, which is A016921.
a(n)=2 iff n mod 24 = 3 or 5.
EXAMPLE
n = 10571 written in factorial base is 2,0,4,0,1,2,1. It ends in 3 consecutive nonzero digits (1,2,1) so a(10571) = 3. Remainder 10571 mod (3+2)! = 11 is in A227157 row 3.
MATHEMATICA
a[n_] := Module[{k = n, m = 2, r}, While[{k, r} = QuotientRemainder[k, m]; r != 0, m++]; m - 2]; Array[a, 30, 0] (* Amiram Eldar, Feb 15 2021 after Kevin Ryde's PARI code *)
PROG
(PARI) a(n) = my(b=2, r); while([n, r]=divrem(n, b); r!=0, b++); b-2;
CROSSREFS
Cf. A108731 (factorial base digits), A016921 (where a(n)=1), A339013 (+2), A230403 (ending 0's).
In other bases: A215887, A328570.
Sequence in context: A035446 A126211 A095414 * A357984 A328766 A219203
KEYWORD
base,nonn
AUTHOR
Kevin Ryde, Nov 19 2020
STATUS
approved