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.

A276008 Substitute ones for all nonzero digits in factorial base representation of n: a(n) = A059590(A275727(n)).

This page as a plain text file.
%I A276008 #20 Feb 14 2024 01:05:02
%S A276008 0,1,2,3,2,3,6,7,8,9,8,9,6,7,8,9,8,9,6,7,8,9,8,9,24,25,26,27,26,27,30,
%T A276008 31,32,33,32,33,30,31,32,33,32,33,30,31,32,33,32,33,24,25,26,27,26,27,
%U A276008 30,31,32,33,32,33,30,31,32,33,32,33,30,31,32,33,32,33,24,25,26,27,26,27,30,31,32,33,32,33,30,31,32,33,32,33,30,31,32,33,32,33,24
%N A276008 Substitute ones for all nonzero digits in factorial base representation of n: a(n) = A059590(A275727(n)).
%H A276008 Antti Karttunen, <a href="/A276008/b276008.txt">Table of n, a(n) for n = 0..40319</a>
%H A276008 <a href="/index/Fa#facbase">Index entries for sequences related to factorial base representation</a>.
%F A276008 a(n) = A059590(A275727(n)).
%e A276008 For n=23 whose factorial base representation is "321", when we replace each nonzero digit with 1, we get "111", the factorial base representation of 9, thus a(23) = 9.
%e A276008 From n=37 ("1201") we get "1101", thus a(37) = 31 as A007623(31) = 1101.
%t A276008 a[n_] := Module[{k = n, m = 2, r, s = {}}, While[{k, r} = QuotientRemainder[k, m]; k != 0|| r != 0, AppendTo[s, r]; m++]; s = Min[#, 1]& /@ s; Total[s*Range[Length[s]]!]]; Array[a, 100, 0] (* _Amiram Eldar_, Feb 14 2024 *)
%o A276008 (Scheme)
%o A276008 (define (A276008 n) (A059590 (A275727 n)))
%o A276008 ;; Standalone program:
%o A276008 (define (A276008 n) (let loop ((n n) (s 0) (f 1) (i 2)) (if (zero? n) s (let ((d (modulo n i))) (if (zero? d) (loop (/ n i) s (* i f) (+ 1 i)) (loop (/ (- n d) i) (+ s f) (* i f) (+ 1 i)))))))
%o A276008 (Python)
%o A276008 from sympy import factorial as f
%o A276008 def a007623(n, p=2): return n if n<p else a007623(n//p, p+1)*10 + n%p
%o A276008 def a(n):
%o A276008     x=str(a007623(n))
%o A276008     y="".join('1' if int(i)>0 else '0' for i in x)[::-1]
%o A276008     return sum([int(y[i])*f(i + 1) for i in range(len(y))])
%o A276008 print([a(n) for n in range(201)]) # _Indranil Ghosh_, Jun 21 2017
%Y A276008 Cf. A059590, A275727.
%Y A276008 Cf. also A276009.
%K A276008 nonn,base
%O A276008 0,3
%A A276008 _Antti Karttunen_, Aug 18 2016