%I #20 Jan 24 2024 01:49:50
%S 0,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,0,1,0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,
%T 1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,0,1,0,1,
%U 1,1,0,1,0,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,0,1,0,1,1,1,0,1,0,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,0,1,0,1,1,1,0,1,1
%N Characteristic function for A256450: 1 if there is at least one 1-digit present in the factorial representation of n (A007623), otherwise 0.
%H Antti Karttunen, <a href="/A257680/b257680.txt">Table of n, a(n) for n = 0..10080</a>
%F a(0) = 0; for n >= 1, if A099563(n) = 1, then a(n) = 1, otherwise a(n) = a(A257687(n)).
%F Other identities:
%F a(2n+1) = 1 for all n. [Because all odd numbers end with digit 1 in factorial base.]
%t a[n_] := Module[{k = n, m = 2, c = 0, r}, While[{k, r} = QuotientRemainder[k, m]; k != 0 || r != 0, If[r == 1, c++]; m++]; If[c > 0, 1, 0]]; Array[a, 100, 0] (* _Amiram Eldar_, Jan 23 2024 *)
%o (Scheme)
%o (define (A257680 n) (let loop ((n n) (i 2)) (cond ((zero? n) 0) ((= 1 (modulo n i)) 1) (else (loop (floor->exact (/ n i)) (+ 1 i))))))
%o ;; As a recurrence utilizing memoizing definec-macro:
%o (definec (A257680 n) (cond ((zero? n) 0) ((= 1 (A099563 n)) 1) (else (A257680 (A257687 n)))))
%o (Python)
%o def a007623(n, p=2): return n if n<p else a007623(n//p, p+1)*10 + n%p
%o def a(n): return 1 if '1' in str(a007623(n)) else 0
%o print([a(n) for n in range(101)]) # _Indranil Ghosh_, Jun 21 2017
%Y Characteristic function of A256450.
%Y Cf. A255411 (gives the positions of zeros), A257682 (partial sums).
%Y Cf. also A007623, A099563, A257685, A257687.
%K nonn,base
%O 0
%A _Antti Karttunen_, May 04 2015
|