A278159 Run length transform of primorials, A002110.
1, 2, 2, 6, 2, 4, 6, 30, 2, 4, 4, 12, 6, 12, 30, 210, 2, 4, 4, 12, 4, 8, 12, 60, 6, 12, 12, 36, 30, 60, 210, 2310, 2, 4, 4, 12, 4, 8, 12, 60, 4, 8, 8, 24, 12, 24, 60, 420, 6, 12, 12, 36, 12, 24, 36, 180, 30, 60, 60, 180, 210, 420, 2310, 30030, 2, 4, 4, 12, 4, 8, 12, 60, 4, 8, 8, 24, 12, 24, 60, 420, 4, 8, 8, 24, 8, 16, 24, 120, 12, 24, 24, 72, 60, 120, 420
Offset: 0
Examples
For n=7, "111" in binary, there is a run of 1-bits of length 3, thus a(7) = product of A002110(3), = A002110(3) = 30. For n=39, "10111" in binary, there are two runs, of lengths 1 and 3, thus a(39) = A002110(1) * A002110(3) = 2*30 = 60.
Links
Programs
-
Mathematica
f[n_] := Product[Prime[k], {k, 1, n}]; Table[Times @@ (f[Length[#]]&) /@ Select[Split[IntegerDigits[n, 2]], #[[1]] == 1&], {n, 0, 94}] (* Jean-François Alcover, Jul 11 2017 *)
-
Python
from math import prod from re import split from sympy import primorial def RLT(n,f): """ run length transform of a function f """ return prod(f(len(d)) for d in split('0+', bin(n)[2:]) if d != '') if n > 0 else 1 def A278159(n): return RLT(n,primorial) # Chai Wah Wu, Feb 04 2022
-
Scheme
(define (A278159 n) (fold-left (lambda (a r) (* a (A002110 r))) 1 (bisect (reverse (binexp->runcount1list n)) (- 1 (modulo n 2))))) ;; See A227349 for the required other functions.
Comments