%I #46 Aug 01 2024 09:12:49
%S 0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,
%T 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
%U 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
%N Characteristic function of the factorials 1!, 2!, 3!, ...
%C A word that is neither morphic nor recurrent.
%H Antti Karttunen, <a href="/A316341/b316341.txt">Table of n, a(n) for n = 0..65537</a>
%H Jean-Paul Allouche, Julien Cassaigne, Jeffrey Shallit, and Luca Q. Zamboni, <a href="https://arxiv.org/abs/1711.10807">A Taxonomy of Morphic Sequences</a>, arXiv preprint arXiv:1711.10807 [cs.FL], Nov 29 2017.
%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>
%F a(n) = 1 if A034968(n) == 1, 0 otherwise. - _Antti Karttunen_, Nov 07 2018
%F a(n) = A084558(n) - A084558(n-1) for n>=1. - _Alan Michael Gómez Calderón_, Jul 31 2024
%t CoefficientList[Sum[x^k!, {k, 1, 5}], x] (* _Jean-François Alcover_, Nov 02 2018 *)
%o (PARI)
%o A034968(n) = { my(s=0, b=2, d); while(n, d = (n%b); s += d; n = (n-d)/b; b++); (s); };
%o A316341(n) = (1==A034968(n)); \\ _Antti Karttunen_, Nov 07 2018
%o first(n) = { my(res = vector(n), i = t = 1); while(t < n, res[t+1]=1; i++; t*=i); res; }; \\ _David A. Corneth_, Nov 07 2018
%o A316341(n) = for(m=2,n, (n%m || 2>n\=m) && break);n==1; \\ _M. F. Hasler_, Jan 19 2023
%o (Python)
%o def A316341(n):
%o c, i = 1, 1
%o while (c:=c*i) < n:
%o i += 1
%o return int(c==n) # _Chai Wah Wu_, Jan 11 2023
%Y Equals A012245 prefixed by 0 (up to offset and indexing convention).
%Y Cf. A084558 (partial sums).
%Y Sequences mentioned in the Allouche et al. "Taxonomy" paper, listed by example number: 1: A003849, 2: A010060, 3: A010056, 4: A020985 and A020987, 5: A191818, 6: A316340 and A273129, 18: A316341, 19: A030302, 20: A063438, 21: A316342, 22: A316343, 23: A003849 minus its first term, 24: A316344, 25: A316345 and A316824, 26: A020985 and A020987, 27: A316825, 28: A159689, 29: A049320, 30: A003849, 31: A316826, 32: A316827, 33: A316828, 34: A316344, 35: A043529, 36: A316829, 37: A010060.
%Y Cf. also A000142, A034968.
%K nonn
%O 0
%A _N. J. A. Sloane_, Jul 14 2018
%E Data section extended up to a(120) by _Antti Karttunen_, Nov 07 2018