|
|
A246660
|
|
Run Length Transform of factorials.
|
|
16
|
|
|
1, 1, 1, 2, 1, 1, 2, 6, 1, 1, 1, 2, 2, 2, 6, 24, 1, 1, 1, 2, 1, 1, 2, 6, 2, 2, 2, 4, 6, 6, 24, 120, 1, 1, 1, 2, 1, 1, 2, 6, 1, 1, 1, 2, 2, 2, 6, 24, 2, 2, 2, 4, 2, 2, 4, 12, 6, 6, 6, 12, 24, 24, 120, 720, 1, 1, 1, 2, 1, 1, 2, 6, 1, 1, 1, 2, 2, 2, 6, 24, 1, 1, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,4
|
|
COMMENTS
|
For the definition of the Run Length Transform see A246595.
Only Jordan-Polya numbers (A001013) are terms of this sequence.
|
|
LINKS
|
|
|
FORMULA
|
a(2^n-1) = n!.
|
|
MATHEMATICA
|
Table[Times @@ (Length[#]!&) /@ Select[Split[IntegerDigits[n, 2]], #[[1]] == 1&], {n, 0, 83}] (* Jean-François Alcover, Jul 11 2017 *)
|
|
PROG
|
(Sage)
def RLT(f, size):
L = lambda n: [a for a in Integer(n).binary().split('0') if a != '']
return [mul([f(len(d)) for d in L(n)]) for n in range(size)]
A246660_list = lambda len: RLT(factorial, len)
(PARI)
A246660(n) = { my(i=0, p=1); while(n>0, if(n%2, i++; p = p * i, i = 0); n = n\2); p; };
for(n=0, 8192, write("b246660.txt", n, " ", A246660(n)));
(Scheme)
;; A stand-alone loop version, like the Pari-program above:
(define (A246660 n) (let loop ((n n) (i 0) (p 1)) (cond ((zero? n) p) ((odd? n) (loop (/ (- n 1) 2) (+ i 1) (* p (+ 1 i)))) (else (loop (/ n 2) 0 p)))))
;; One based on given recurrence, utilizing memoizing definec-macro from my IntSeq-library:
;; Yet another implementation, using fold:
(define (A246660 n) (fold-left (lambda (a r) (* a (A000142 r))) 1 (bisect (reverse (binexp->runcount1list n)) (- 1 (modulo n 2)))))
(Python)
from operator import mul
from functools import reduce
from re import split
from math import factorial
return reduce(mul, (factorial(len(d)) for d in split('0+', bin(n)[2:]) if d)) if n > 0 else 1 # Chai Wah Wu, Sep 09 2014
|
|
CROSSREFS
|
Cf. A003714 (gives the positions of ones).
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|