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.

A257260 One-based position of the rightmost zero in the factorial base representation of n (A007623), 0 if no nonleading zeros present.

This page as a plain text file.
%I A257260 #18 Feb 07 2024 01:17:18
%S A257260 0,1,0,1,0,1,2,1,0,1,0,1,2,1,0,1,0,1,2,1,0,1,0,1,2,1,3,1,3,1,2,1,0,1,
%T A257260 0,1,2,1,0,1,0,1,2,1,0,1,0,1,2,1,3,1,3,1,2,1,0,1,0,1,2,1,0,1,0,1,2,1,
%U A257260 0,1,0,1,2,1,3,1,3,1,2,1,0,1,0,1,2,1,0,1,0,1,2,1,0,1,0,1,2,1,3,1,3,1,2,1,0,1,0,1,2,1,0,1,0,1,2,1,0,1,0,1
%N A257260 One-based position of the rightmost zero in the factorial base representation of n (A007623), 0 if no nonleading zeros present.
%C A257260 a(n) gives the distance of the rightmost zero from the right hand end of factorial base representation of n (A007623), particularly, 1 when n is even, and 0 for those cases when there are no nonleading zeros present (terms of A227157).
%C A257260 Sequence starts from n=1, to avoid ambiguities with case zero.
%H A257260 Antti Karttunen, <a href="/A257260/b257260.txt">Table of n, a(n) for n = 1..10080</a>
%H A257260 <a href="/index/Fa#facbase">Index entries for sequences related to factorial base representation</a>.
%e A257260 For n = 1, with factorial base representation (A007623) "1", there are no nonleading zeros at all, thus a(1) = 0.
%e A257260 For n = 6, with representation "100", the rightmost zero occurs at digit-position 1 (when the least significant digit has index 1, etc.), thus a(6) = 1.
%e A257260 For n = 7, with representation "101", the rightmost zero occurs at position 2, thus a(7) = 2.
%t A257260 a[n_] := Module[{k = n, m = 2, r, s = {}, p}, While[{k, r} = QuotientRemainder[k, m]; k != 0|| r != 0, AppendTo[s, r]; m++]; If[MissingQ[(p = FirstPosition[s, 0])], 0, p[[1]]]]; Array[a, 100] (* _Amiram Eldar_, Feb 07 2024 *)
%o A257260 (Scheme) (define (A257260 n) (let loop ((n n) (i 2)) (cond ((zero? n) 0) ((zero? (modulo n i)) (- i 1)) (else (loop (floor->exact (/ n i)) (+ 1 i))))))
%Y A257260 Cf. A007623, A227157 (positions of zeros), A000012 (even bisection).
%Y A257260 Cf. also A257261, A230403, and arrays of permutations A060117 and A060118.
%K A257260 nonn,base
%O A257260 1,7
%A A257260 _Antti Karttunen_, Apr 29 2015