login
Run length transform of primorials, A002110.
11

%I #22 Feb 04 2022 11:19:10

%S 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,

%T 30,60,210,2310,2,4,4,12,4,8,12,60,4,8,8,24,12,24,60,420,6,12,12,36,

%U 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

%N Run length transform of primorials, A002110.

%C Like every run length transform this sequence satisfies for all i, j: A278222(i) = A278222(j) => a(i) = a(j).

%H Antti Karttunen, <a href="/A278159/b278159.txt">Table of n, a(n) for n = 0..8192</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%H <a href="/index/Ru#rlt">Index entries for sequences computed with run length transform</a>

%F a(n) = A124859(A005940(1+n)).

%e 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.

%e 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.

%t 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 *)

%o (Scheme)

%o (define (A278159 n) (fold-left (lambda (a r) (* a (A002110 r))) 1 (bisect (reverse (binexp->runcount1list n)) (- 1 (modulo n 2)))))

%o ;; See A227349 for the required other functions.

%o (Python)

%o from math import prod

%o from re import split

%o from sympy import primorial

%o def RLT(n,f):

%o """ run length transform of a function f """

%o return prod(f(len(d)) for d in split('0+', bin(n)[2:]) if d != '') if n > 0 else 1

%o def A278159(n): return RLT(n,primorial) # _Chai Wah Wu_, Feb 04 2022

%Y Cf. A002110, A005940, A124859, A227349, A246660, A278161, A278222.

%K nonn,base

%O 0,2

%A _Antti Karttunen_, Nov 16 2016