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.

A257679 The smallest nonzero digit present in the factorial base representation (A007623) of n, 0 if no nonzero digits present.

This page as a plain text file.
%I A257679 #38 Jan 24 2024 01:49:46
%S A257679 0,1,1,1,2,1,1,1,1,1,1,1,2,1,1,1,2,1,3,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,
%T A257679 1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,2,1,1,1,1,1,1,1,2,1,1,1,2,1,2,1,
%U A257679 1,1,2,1,3,1,1,1,2,1,1,1,1,1,1,1,2,1,1,1,2,1,3,1,1,1,2,1,4,1,1,1,2,1,1,1,1,1,1,1,2,1,1,1,2,1,3,1,1,1,2,1,1
%N A257679 The smallest nonzero digit present in the factorial base representation (A007623) of n, 0 if no nonzero digits present.
%C A257679 a(0) = 0 by convention, because "0" has no nonzero digits present.
%C A257679 a(n) gives the row index of n in array A257503 (equally, the column index for array A257505).
%H A257679 Antti Karttunen, <a href="/A257679/b257679.txt">Table of n, a(n) for n = 0..5040</a>
%F A257679 If A257687(n) = 0, then a(n) = A099563(n), otherwise a(n) = min(A099563(n), a(A257687(n))).
%F A257679 In other words, if n is either zero or one of the terms of A051683, then a(n) = A099563(n) [the most significant digit of its f.b.r.], otherwise take the minimum of the most significant digit and a(A257687(n)) [value computed by recursing with a smaller value obtained by discarding that most significant digit].
%F A257679 a(0) = 0, and for n >= 1: if A257680(n) = 1, then a(n) = 1, otherwise 1 + a(A257684(n)).
%F A257679 Other identities:
%F A257679 For all n >= 0, a(A001563(n)) = n. [n * n! gives the first position where n appears. Note also that the "digits" (placeholders) in factorial base representation may get arbitrarily large values.]
%F A257679 For all n >= 0, a(2n+1) = 1 [because all odd numbers end with digit 1 in factorial base].
%e A257679 Factorial base representation (A007623) of 4 is "20", the smallest digit which is not zero is "2", thus a(4) = 2.
%t A257679 a[n_] := Module[{k = n, m = 2, rmin = n, r}, While[{k, r} = QuotientRemainder[k, m]; k != 0 || r != 0, If[0 < r < rmin, rmin = r]; m++]; rmin]; Array[a, 100, 0] (* _Amiram Eldar_, Jan 23 2024 *)
%o A257679 (Scheme)
%o A257679 (define (A257679 n) (let loop ((n n) (i 2) (mind 0)) (if (zero? n) mind (let ((d (modulo n i))) (loop (/ (- n d) i) (+ 1 i) (cond ((zero? mind) d) ((zero? d) mind) (else (min d mind))))))))
%o A257679 ;; Alternative implementations based on given recurrences, using memoizing definec-macro:
%o A257679 (definec (A257679 n) (if (zero? (A257687 n)) (A099563 n) (min (A099563 n) (A257679 (A257687 n)))))
%o A257679 (definec (A257679 n) (cond ((zero? n) n) ((= 1 (A257680 n)) 1) (else (+ 1 (A257679 (A257684 n))))))
%o A257679 (Python)
%o A257679 def A(n, p=2):
%o A257679     return n if n<p else A(n//p, p+1)*10 + n%p
%o A257679 def a(n):
%o A257679     return 0 if n==0 else min(int(i) for i in str(A(n)) if i !='0')
%o A257679 print([a(n) for n in range(201)]) # _Indranil Ghosh_, Jun 19 2017
%Y A257679 Positions of records: A001563.
%Y A257679 Cf. A256450, A257692, A257693 (positions of 1's, 2's and 3's in this sequence).
%Y A257679 Cf. A007623, A051683, A099563, A257680, A257684, A257687.
%Y A257679 Cf. also A257079, A246359 and arrays A257503, A257505.
%K A257679 nonn,base
%O A257679 0,5
%A A257679 _Antti Karttunen_, May 04 2015