A059590 Numbers obtained by reinterpreting base-2 representation of n in the factorial base: a(n) = Sum_{k>=0} A030308(n,k)*A000142(k+1).
Examples
128 is in the sequence since 5! + 3! + 2! = 128. a(22) = 128. a(22) = a(6) + (1 + floor(log(16) / log(2)))! = 8 + 5! = 128. Also, 22 = 10110_2. Therefore, a(22) = 1 * 5! + 0 * 4! + 1 * 3! + 1 + 2! + 0 * 0! = 128. - _David A. Corneth_, Aug 21 2016
Links
- Reinhard Zumkeller (terms 0..500) & Antti Karttunen, Table of n, a(n) for n = 0..8191
- Index entries for sequences related to factorial base representation
- Index entries for sequences related to factorial numbers
Programs
-
Haskell
import Data.List (elemIndices) a059590 n = a059590_list !! n a059590_list = elemIndices 1 $ map a115944 [0..] -- Reinhard Zumkeller, Dec 04 2011
-
Maple
[seq(bin2facbase(j),j=0..64)]; bin2facbase := proc(n) local i; add((floor(n/(2^i)) mod 2)*((i+1)!),i=0..floor_log_2(n)); end; floor_log_2 := proc(n) local nn,i; nn := n; for i from -1 to n do if(0 = nn) then RETURN(i); fi; nn := floor(nn/2); od; end; # next Maple program: a:= n-> (l-> add(l[j]*j!, j=1..nops(l)))(Bits[Split](n)): seq(a(n), n=0..57); # Alois P. Heinz, Aug 12 2025
-
Mathematica
a[n_] := Reverse[id = IntegerDigits[n, 2]].Range[Length[id]]!; Table[a[n], {n, 0, 60}] (* Jean-François Alcover, Jun 19 2012, after Philippe Deléham *)
-
PARI
a(n) = if(n>0, a(n-msb(n)) + (1+logint(n,2))!, 0) msb(n) = 2^#binary(n)>>1 {my(b = binary(n)); sum(i=1,#b,b[i]*(#b+1-i)!)} \\ David A. Corneth, Aug 21 2016
-
Python
def facbase(k, f): return sum(f[i] for i, bi in enumerate(bin(k)[2:][::-1]) if bi == "1") def auptoN(N): # terms up to N factorial-base digits; 13 generates b-file f = [factorial(i) for i in range(1, N+1)] return list(facbase(k, f) for k in range(2**N)) print(auptoN(5)) # Michael S. Branicky, Oct 15 2022
Comments