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.

Showing 1-10 of 15 results. Next

A323506 a(n) = A323505(n) / A246660(n).

Original entry on oeis.org

1, 2, 4, 3, 8, 12, 6, 4, 16, 24, 24, 24, 12, 18, 8, 5, 32, 48, 48, 48, 48, 72, 48, 40, 24, 36, 36, 36, 16, 24, 10, 6, 64, 96, 96, 96, 96, 144, 96, 80, 96, 144, 144, 144, 96, 144, 80, 60, 48, 72, 72, 72, 72, 108, 72, 60, 32, 48, 48, 48, 20, 30, 12, 7, 128, 192, 192, 192, 192, 288, 192, 160, 192, 288, 288, 288, 192, 288, 160, 120
Offset: 0

Views

Author

Antti Karttunen, Jan 16 2019

Keywords

Examples

			This sequence can be represented as a binary tree, as both A323505 and A246660 have similar tree structures:
                                       1
                                       |
                    ...................2....................
                   4                                        3
         8......../ \........12                  6........./ \.......4
        / \                 / \                 / \                 / \
       /   \               /   \               /   \               /   \
      /     \             /     \             /     \             /     \
    16       24         24       24         12       18          8       5
  32  48   48  48     48  72   48  40     24  36   36  36      16 24   10  6
etc.
		

Crossrefs

Programs

Formula

a(n) = A323505(n) / A246660(n).
For n > 1, a(2n) = 2*a(n).

A156552 Unary-encoded compressed factorization of natural numbers.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 8, 7, 6, 9, 16, 11, 32, 17, 10, 15, 64, 13, 128, 19, 18, 33, 256, 23, 12, 65, 14, 35, 512, 21, 1024, 31, 34, 129, 20, 27, 2048, 257, 66, 39, 4096, 37, 8192, 67, 22, 513, 16384, 47, 24, 25, 130, 131, 32768, 29, 36, 71, 258, 1025, 65536, 43, 131072, 2049, 38, 63, 68, 69, 262144
Offset: 1

Views

Author

Leonid Broukhis, Feb 09 2009

Keywords

Comments

The primes become the powers of 2 (2 -> 1, 3 -> 2, 5 -> 4, 7 -> 8); the composite numbers are formed by taking the values for the factors in the increasing order, multiplying them by the consecutive powers of 2, and summing. See the Example section.
From Antti Karttunen, Jun 27 2014: (Start)
The odd bisection (containing even terms) halved gives A244153.
The even bisection (containing odd terms), when one is subtracted from each and halved, gives this sequence back.
(End)
Question: Are there any other solutions that would satisfy the recurrence r(1) = 0; and for n > 1, r(n) = Sum_{d|n, d>1} 2^A033265(r(d)), apart from simple variants 2^k * A156552(n)? See also A297112, A297113. - Antti Karttunen, Dec 30 2017

Examples

			For 84 = 2*2*3*7 -> 1*1 + 1*2 + 2*4 + 8*8 =  75.
For 105 = 3*5*7 -> 2*1 + 4*2 + 8*4 = 42.
For 137 = p_33 -> 2^32 = 4294967296.
For 420 = 2*2*3*5*7 -> 1*1 + 1*2 + 2*4 + 4*8 + 8*16 = 171.
For 147 = 3*7*7 = p_2 * p_4 * p_4 -> 2*1 + 8*2 + 8*4 = 50.
		

Crossrefs

One less than A005941.
Inverse permutation: A005940 with starting offset 0 instead of 1.
Cf. also A297106, A297112 (Möbius transform), A297113, A153013, A290308, A300827, A323243, A323244, A323247, A324201, A324812 (n for which a(n) is a square), A324813, A324822, A324823, A324398, A324713, A324815, A324819, A324865, A324866, A324867.

Programs

  • Mathematica
    Table[Floor@ Total@ Flatten@ MapIndexed[#1 2^(#2 - 1) &, Flatten[ Table[2^(PrimePi@ #1 - 1), {#2}] & @@@ FactorInteger@ n]], {n, 67}] (* Michael De Vlieger, Sep 08 2016 *)
  • PARI
    a(n) = {my(f = factor(n), p2 = 1, res = 0); for(i = 1, #f~, p = 1 << (primepi(f[i, 1]) - 1); res += (p * p2 * (2^(f[i, 2]) - 1)); p2 <<= f[i, 2]); res}; \\ David A. Corneth, Mar 08 2019
    
  • PARI
    A064989(n) = {my(f); f = factor(n); if((n>1 && f[1,1]==2), f[1,2] = 0); for (i=1, #f~, f[i,1] = precprime(f[i,1]-1)); factorback(f)};
    A156552(n) = if(1==n, 0, if(!(n%2), 1+(2*A156552(n/2)), 2*A156552(A064989(n)))); \\ (based on the given recurrence) - Antti Karttunen, Mar 08 2019
    
  • Perl
    # Program corrected per instructions from Leonid Broukhis. - Antti Karttunen, Jun 26 2014
    # However, it gives correct answers only up to n=136, before corruption by a wrap-around effect.
    # Note that the correct answer for n=137 is A156552(137) = 4294967296.
    $max = $ARGV[0];
    $pow = 0;
    foreach $i (2..$max) {
    @a = split(/ /, `factor $i`);
    shift @a;
    $shift = 0;
    $cur = 0;
    while ($n = int shift @a) {
    $prime{$n} = 1 << $pow++ if !defined($prime{$n});
    $cur |= $prime{$n} << $shift++;
    }
    print "$cur, ";
    }
    print "\n";
    (Scheme, with memoization-macro definec from Antti Karttunen's IntSeq-library, two different implementations)
    (definec (A156552 n) (cond ((= n 1) 0) (else (+ (A000079 (+ -2 (A001222 n) (A061395 n))) (A156552 (A052126 n))))))
    (definec (A156552 n) (cond ((= 1 n) (- n 1)) ((even? n) (+ 1 (* 2 (A156552 (/ n 2))))) (else (* 2 (A156552 (A064989 n))))))
    ;; Antti Karttunen, Jun 26 2014
    
  • Python
    from sympy import primepi, factorint
    def A156552(n): return sum((1<Chai Wah Wu, Mar 10 2023

Formula

From Antti Karttunen, Jun 26 2014: (Start)
a(1) = 0, a(n) = A000079(A001222(n)+A061395(n)-2) + a(A052126(n)).
a(1) = 0, a(2n) = 1+2*a(n), a(2n+1) = 2*a(A064989(2n+1)). [Compare to the entanglement recurrence A243071].
For n >= 0, a(2n+1) = 2*A244153(n+1). [Follows from the latter clause of the above formula.]
a(n) = A005941(n) - 1.
As a composition of related permutations:
a(n) = A003188(A243354(n)).
a(n) = A054429(A243071(n)).
For all n >= 1, A005940(1+a(n)) = n and for all n >= 0, a(A005940(n+1)) = n. [The offset-0 version of A005940 works as an inverse for this permutation.]
This permutations also maps between the partition-lists A112798 and A125106:
A056239(n) = A161511(a(n)). [The sums of parts of each partition (the total sizes).]
A003963(n) = A243499(a(n)). [And also the products of those parts.]
(End)
From Antti Karttunen, Oct 09 2016: (Start)
A161511(a(n)) = A056239(n).
A029837(1+a(n)) = A252464(n). [Binary width of terms.]
A080791(a(n)) = A252735(n). [Number of nonleading 0-bits.]
A000120(a(n)) = A001222(n). [Binary weight.]
For all n >= 2, A001511(a(n)) = A055396(n).
For all n >= 2, A000120(a(n))-1 = A252736(n). [Binary weight minus one.]
A252750(a(n)) = A252748(n).
a(A250246(n)) = A252754(n).
a(A005117(n)) = A277010(n). [Maps squarefree numbers to a permutation of A003714, fibbinary numbers.]
A085357(a(n)) = A008966(n). [Ditto for their characteristic functions.]
For all n >= 0:
a(A276076(n)) = A277012(n).
a(A276086(n)) = A277022(n).
a(A260443(n)) = A277020(n).
(End)
From Antti Karttunen, Dec 30 2017: (Start)
For n > 1, a(n) = Sum_{d|n, d>1} 2^A033265(a(d)). [See comments.]
More linking formulas:
A106737(a(n)) = A000005(n).
A290077(a(n)) = A000010(n).
A069010(a(n)) = A001221(n).
A136277(a(n)) = A181591(n).
A132971(a(n)) = A008683(n).
A106400(a(n)) = A008836(n).
A268411(a(n)) = A092248(n).
A037011(a(n)) = A010052(n) [conjectured, depends on the exact definition of A037011].
A278161(a(n)) = A046951(n).
A001316(a(n)) = A061142(n).
A277561(a(n)) = A034444(n).
A286575(a(n)) = A037445(n).
A246029(a(n)) = A181819(n).
A278159(a(n)) = A124859(n).
A246660(a(n)) = A112624(n).
A246596(a(n)) = A069739(n).
A295896(a(n)) = A053866(n).
A295875(a(n)) = A295297(n).
A284569(a(n)) = A072411(n).
A286574(a(n)) = A064547(n).
A048735(a(n)) = A292380(n).
A292272(a(n)) = A292382(n).
A244154(a(n)) = A048673(n), a(A064216(n)) = A244153(n).
A279344(a(n)) = A279339(n), a(A279338(n)) = A279343(n).
a(A277324(n)) = A277189(n).
A037800(a(n)) = A297155(n).
For n > 1, A033265(a(n)) = 1+A297113(n).
(End)
From Antti Karttunen, Mar 08 2019: (Start)
a(n) = A048675(n) + A323905(n).
a(A324201(n)) = A000396(n), provided there are no odd perfect numbers.
The following sequences are derived from or related to the base-2 expansion of a(n):
A000265(a(n)) = A322993(n).
A002487(a(n)) = A323902(n).
A005187(a(n)) = A323247(n).
A324288(a(n)) = A324116(n).
A323505(a(n)) = A323508(n).
A079559(a(n)) = A323512(n).
A085405(a(n)) = A323239(n).
The following sequences are obtained by applying to a(n) a function that depends on the prime factorization of its argument, which goes "against the grain" because a(n) is the binary code of the factorization of n, which in these cases is then factored again:
A000203(a(n)) = A323243(n).
A033879(a(n)) = A323244(n) = 2*a(n) - A323243(n),
A294898(a(n)) = A323248(n).
A000005(a(n)) = A324105(n).
A000010(a(n)) = A324104(n).
A083254(a(n)) = A324103(n).
A001227(a(n)) = A324117(n).
A000593(a(n)) = A324118(n).
A001221(a(n)) = A324119(n).
A009194(a(n)) = A324396(n).
A318458(a(n)) = A324398(n).
A192895(a(n)) = A324100(n).
A106315(a(n)) = A324051(n).
A010052(a(n)) = A324822(n).
A053866(a(n)) = A324823(n).
A001065(a(n)) = A324865(n) = A323243(n) - a(n),
A318456(a(n)) = A324866(n) = A324865(n) OR a(n),
A318457(a(n)) = A324867(n) = A324865(n) XOR a(n),
A318458(a(n)) = A324398(n) = A324865(n) AND a(n),
A318466(a(n)) = A324819(n) = A323243(n) OR 2*a(n),
A318467(a(n)) = A324713(n) = A323243(n) XOR 2*a(n),
A318468(a(n)) = A324815(n) = A323243(n) AND 2*a(n).
(End)

Extensions

More terms from Antti Karttunen, Jun 28 2014

A278222 The least number with the same prime signature as A005940(n+1).

Original entry on oeis.org

1, 2, 2, 4, 2, 6, 4, 8, 2, 6, 6, 12, 4, 12, 8, 16, 2, 6, 6, 12, 6, 30, 12, 24, 4, 12, 12, 36, 8, 24, 16, 32, 2, 6, 6, 12, 6, 30, 12, 24, 6, 30, 30, 60, 12, 60, 24, 48, 4, 12, 12, 36, 12, 60, 36, 72, 8, 24, 24, 72, 16, 48, 32, 64, 2, 6, 6, 12, 6, 30, 12, 24, 6, 30, 30, 60, 12, 60, 24, 48, 6, 30, 30, 60, 30, 210, 60, 120, 12, 60, 60, 180, 24, 120, 48, 96, 4, 12, 12
Offset: 0

Views

Author

Antti Karttunen, Nov 15 2016

Keywords

Comments

This sequence can be used for filtering certain base-2 related sequences, because it matches only with any such sequence b that can be computed as b(n) = f(A005940(n+1)), where f(n) is any function that depends only on the prime signature of n (some of these are listed under the index entry for "sequences computed from exponents in ...").
Matching in this context means that the sequence a matches with the sequence b iff for all i, j: a(i) = a(j) => b(i) = b(j). In other words, iff the sequence b partitions the natural numbers to the same or coarser equivalence classes (as/than the sequence a) by the distinct values it obtains.
Because the Doudna map n -> A005940(1+n) is an isomorphism from "unary-binary encoding of factorization" (see A156552) to the ordinary representation of the prime factorization of n, it follows that the equivalence classes of this sequence match with any such sequence b, where b(n) is computed from the lengths of 1-runs in the binary representation of n and the order of those 1-runs does not matter. Particularly, this holds for any sequence that is obtained as a "Run Length Transform", i.e., where b(n) = Product S(i), for some function S, where i runs through the lengths of runs of 1's in the binary expansion of n. See for example A227349.
However, this sequence itself is not a run length transform of any sequence (which can be seen for example from the fact that A046523 is not multiplicative).
Furthermore, this matches not only with sequences involving products of S(i), but with any sequence obtained with any commutative function applied cumulatively, like e.g., A000120 (binary weight, obtained in this case as Sum identity(i)), and A069010 (number of runs of 1's in binary representation of n, obtained as Sum signum(i)).

Crossrefs

Similar sequences: A278217, A278219 (other base-2 related variants), A069877 (base-10 related), A278226 (primorial base), A278234-A278236 (factorial base), A278243 (Stern polynomials), A278233 (factorization in ring GF(2)[X]), A046523 (factorization in Z).
Cf. also A286622 (rgs-transform of this sequence) and A286162, A286252, A286163, A286240, A286242, A286379, A286464, A286374, A286375, A286376, A286243, A286553 (various other sequences involving this sequence).
Sequences that partition N into same or coarser equivalence classes: too many to list all here (over a hundred). At least every sequence listed under index-entry "Run Length Transforms" is included (e.g., A227349, A246660, A278159), and also sequences like A000120 and A069010, and their combinations like A136277.

Programs

  • Mathematica
    f[n_, i_, x_] := Which[n == 0, x, EvenQ@ n, f[n/2, i + 1, x], True, f[(n - 1)/2, i, x Prime@ i]]; Array[If[# == 1, 1, Times @@ MapIndexed[ Prime[First[#2]]^#1 &, Sort[FactorInteger[#][[All, -1]], Greater]]] &@ f[# - 1, 1, 1] &, 99] (* Michael De Vlieger, May 09 2017 *)
  • PARI
    A046523(n)=factorback(primes(#n=vecsort(factor(n)[, 2], , 4)), n)
    a(n)=my(p=2, t=1); for(i=0,exponent(n), if(bittest(n,i), t*=p, p=nextprime(p+1))); A046523(t) \\ Charles R Greathouse IV, Nov 11 2021
  • Python
    from sympy import prime, factorint
    import math
    def A(n): return n - 2**int(math.floor(math.log(n, 2)))
    def b(n): return n + 1 if n<2 else prime(1 + (len(bin(n)[2:]) - bin(n)[2:].count("1"))) * b(A(n))
    def a005940(n): return b(n - 1)
    def P(n):
        f = factorint(n)
        return sorted([f[i] for i in f])
    def a046523(n):
        x=1
        while True:
            if P(n) == P(x): return x
            else: x+=1
    def a(n): return a046523(a005940(n + 1)) # Indranil Ghosh, May 05 2017
    
  • Scheme
    (define (A278222 n) (A046523 (A005940 (+ 1 n))))
    

Formula

a(n) = A046523(A005940(1+n)).
a(n) = A124859(A278159(n)).
a(n) = A278219(A006068(n)).

Extensions

Misleading part of the name removed by Antti Karttunen, Apr 07 2022

A227349 Product of lengths of runs of 1-bits in binary representation of n.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 2, 2, 2, 3, 4, 1, 1, 1, 2, 1, 1, 2, 3, 2, 2, 2, 4, 3, 3, 4, 5, 1, 1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 2, 2, 2, 3, 4, 2, 2, 2, 4, 2, 2, 4, 6, 3, 3, 3, 6, 4, 4, 5, 6, 1, 1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 2, 2, 2, 3, 4, 1, 1, 1, 2, 1, 1, 2, 3, 2, 2, 2, 4, 3, 3, 4, 5, 2, 2, 2, 4, 2, 2, 4, 6, 2, 2, 2, 4, 4, 4, 6, 8, 3, 3, 3, 6, 3, 3, 6, 9, 4
Offset: 0

Views

Author

Antti Karttunen, Jul 08 2013

Keywords

Comments

This is the Run Length Transform of S(n) = {0, 1, 2, 3, 4, 5, 6, ...}. The Run Length Transform of a sequence {S(n), n >= 0} is defined to be the sequence {T(n), n >= 0} given by T(n) = Product_i S(i), where i runs through the lengths of runs of 1's in the binary expansion of n. E.g., 19 is 10011 in binary, which has two runs of 1's, of lengths 1 and 2. So T(19) = S(1)*S(2). T(0) = 1 (the empty product). - N. J. A. Sloane, Sep 05 2014
Like all run length transforms also this sequence satisfies for all i, j: A278222(i) = A278222(j) => a(i) = a(j). - Antti Karttunen, Apr 14 2017

Examples

			a(0) = 1, as zero has no runs of 1's, and an empty product is 1.
a(1) = 1, as 1 is "1" in binary, and the length of that only 1-run is 1.
a(2) = 1, as 2 is "10" in binary, and again there is only one run of 1-bits, of length 1.
a(3) = 2, as 3 is "11" in binary, and there is one run of two 1-bits.
a(55) = 6, as 55 is "110111" in binary, and 2 * 3 = 6.
a(119) = 9, as 119 is "1110111" in binary, and 3 * 3 = 9.
From _Omar E. Pol_, Feb 10 2015: (Start)
Written as an irregular triangle in which row lengths is A011782:
  1;
  1;
  1,2;
  1,1,2,3;
  1,1,1,2,2,2,3,4;
  1,1,1,2,1,1,2,3,2,2,2,4,3,3,4,5;
  1,1,1,2,1,1,2,3,1,1,1,2,2,2,3,4,2,2,2,4,2,2,4,6,3,3,3,6,4,4,5,6;
  ...
Right border gives A028310: 1 together with the positive integers. (End)
From _Omar E. Pol_, Mar 19 2015: (Start)
Also, the sequence can be written as an irregular tetrahedron T(s, r, k) as shown below:
  1;
  ..
  1;
  ..
  1;
  2;
  ....
  1,1;
  2;
  3;
  ........
  1,1,1,2;
  2,2;
  3;
  4;
  ................
  1,1,1,2,1,1,2,3;
  2,2,2,4;
  3,3;
  4;
  5;
  ................................
  1,1,1,2,1,1,2,3,1,1,1,2,2,2,3,4;
  2,2,2,4,2,2,4,6;
  3,3,3,6;
  4,4;
  5;
  6;
  ...
Apart from the initial 1, we have that T(s, r, k) = T(s+1, r, k). (End)
		

Crossrefs

Cf. A003714 (positions of ones), A005361, A005940.
Cf. A000120 (sum of lengths of runs of 1-bits), A167489, A227350, A227193, A278222, A245562, A284562, A284569, A283972, A284582, A284583.
Run Length Transforms of other sequences: A246588, A246595, A246596, A246660, A246661, A246674.
Differs from similar A284580 for the first time at n=119, where a(119) = 9, while A284580(119) = 5.

Programs

  • Maple
    a:= proc(n) local i, m, r; m, r:= n, 1;
          while m>0 do
            while irem(m, 2, 'h')=0 do m:=h od;
            for i from 0 while irem(m, 2, 'h')=1 do m:=h od;
            r:= r*i
          od; r
        end:
    seq(a(n), n=0..100);  # Alois P. Heinz, Jul 11 2013
    ans:=[];
    for n from 0 to 100 do lis:=[]; t1:=convert(n, base, 2); L1:=nops(t1); out1:=1; c:=0;
    for i from 1 to L1 do
       if out1 = 1 and t1[i] = 1 then out1:=0; c:=c+1;
       elif out1 = 0 and t1[i] = 1 then c:=c+1;
       elif out1 = 1 and t1[i] = 0 then c:=c;
       elif out1 = 0 and t1[i] = 0 then lis:=[c, op(lis)]; out1:=1; c:=0;
       fi;
       if i = L1 and c>0 then lis:=[c, op(lis)]; fi;
                       od:
    a:=mul(i, i in lis);
    ans:=[op(ans), a];
    od:
    ans;  # N. J. A. Sloane, Sep 05 2014
  • Mathematica
    onBitRunLenProd[n_] := Times @@ Length /@ Select[Split @ IntegerDigits[n, 2], #[[1]] == 1 & ]; Array[onBitRunLenProd, 100, 0] (* Jean-François Alcover, Mar 02 2016 *)
  • Python
    from operator import mul
    from functools import reduce
    from re import split
    def A227349(n):
        return reduce(mul, (len(d) for d in split('0+',bin(n)[2:]) if d)) if n > 0 else 1 # Chai Wah Wu, Sep 07 2014
    
  • Sage
    # uses[RLT from A246660]
    A227349_list = lambda len: RLT(lambda n: n, len)
    A227349_list(88) # Peter Luschny, Sep 07 2014
    
  • Scheme
    (define (A227349 n) (apply * (bisect (reverse (binexp->runcount1list n)) (- 1 (modulo n 2)))))
    (define (bisect lista parity) (let loop ((lista lista) (i 0) (z (list))) (cond ((null? lista) (reverse! z)) ((eq? i parity) (loop (cdr lista) (modulo (1+ i) 2) (cons (car lista) z))) (else (loop (cdr lista) (modulo (1+ i) 2) z)))))
    (define (binexp->runcount1list n) (if (zero? n) (list) (let loop ((n n) (rc (list)) (count 0) (prev-bit (modulo n 2))) (if (zero? n) (cons count rc) (if (eq? (modulo n 2) prev-bit) (loop (floor->exact (/ n 2)) rc (1+ count) (modulo n 2)) (loop (floor->exact (/ n 2)) (cons count rc) 1 (modulo n 2)))))))

Formula

A167489(n) = a(n) * A227350(n).
A227193(n) = a(n) - A227350(n).
a(n) = Product_{i in row n of table A245562} i. - N. J. A. Sloane, Aug 10 2014
From Antti Karttunen, Apr 14 2017: (Start)
a(n) = A005361(A005940(1+n)).
a(n) = A284562(n) * A284569(n).
A283972(n) = n - a(n).
(End)
a(4n+1) = a(2n) = a(n). If n is odd, then a(4n+3) = 2*a(2n+1)-a(n). If n is even, then a(4n+3) = 2*a(2n+1) = 2*a(n/2). - Chai Wah Wu, Jul 17 2025

Extensions

Data section extended up to term a(120) by Antti Karttunen, Apr 14 2017

A112624 If p^b(p,n) is the highest power of the prime p dividing n, then a(n) = Product_{p|n} b(p,n)!.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 1, 6, 2, 1, 1, 2, 1, 1, 1, 24, 1, 2, 1, 2, 1, 1, 1, 6, 2, 1, 6, 2, 1, 1, 1, 120, 1, 1, 1, 4, 1, 1, 1, 6, 1, 1, 1, 2, 2, 1, 1, 24, 2, 2, 1, 2, 1, 6, 1, 6, 1, 1, 1, 2, 1, 1, 2, 720, 1, 1, 1, 2, 1, 1, 1, 12, 1, 1, 2, 2, 1, 1, 1, 24, 24, 1, 1, 2, 1, 1, 1, 6, 1, 2, 1, 2, 1, 1, 1, 120, 1, 2, 2, 4, 1
Offset: 1

Views

Author

Leroy Quet, Dec 25 2005

Keywords

Comments

The logarithm of the Dirichlet series with the reciprocals of this sequence as coefficients is the Dirichlet series with the characteristic function of primes A010051 as coefficients. - Mats Granvik, Apr 13 2011

Examples

			45 = 3^2 * 5^1. So a(45) = 2! * 1! = 2.
		

Crossrefs

For row > 1: a(n) = row products of A100995(A126988), when neglecting zero elements.

Programs

  • Maple
    w := n -> op(2, ifactors(n)): a := n -> mul(factorial(w(n)[j][2]), j = 1..nops(w(n))): seq(a(n), n = 1..101); # Emeric Deutsch, May 17 2012
  • Mathematica
    f[n_] := Block[{fi = Last@Transpose@FactorInteger@n}, Times @@ (fi!)]; Array[f, 101] (* Robert G. Wilson v, Dec 27 2005 *)
  • PARI
    A112624(n) = { my(f = factor(n), m = 1); for (k=1, #f~, m *= f[k, 2]!; ); m; } \\ Antti Karttunen, May 28 2017
    
  • Sage
    def A112624(n):
        return mul(factorial(s[1]) for s in factor(n))
    [A112624(i) for i in (1..101)]  # Peter Luschny, Jun 15 2013
    
  • Scheme
    (define (A112624 n) (if (= 1 n) n (* (A000142 (A067029 n)) (A112624 (A028234 n))))) ;; Antti Karttunen, May 29 2017

Formula

From Antti Karttunen, May 29 2017: (Start)
a(1) = 1 and for n > 1, a(n) = A000142(A067029(n)) * a(A028234(n)).
a(n) = A246660(A156552(n)). (End)
From Mats Granvik, Mar 05 2019: (Start)
log(a(n)) = inverse Möbius transform of log(A306694(n)).
log(a(n)) = Sum_{k=1..n} [k|n]*log(A306694(n/k))*A000012(k). (End)
From Amiram Eldar, Mar 08 2024: (Start)
Let f(n) = 1/a(n). Formulas from Jakimczuk (2024, pp. 12-15):
Dirichlet g.f. of f(n): Sum_{n>=1} f(n)/n^s = exp(P(s)), where P(s) is the prime zeta function.
Sum_{k=1..n} f(k) = c * n + o(n), where c = A240953.
Sum_{k=1..n} f(k)/k = c * log(n) + o(log(n)), where c = A240953. (End)

Extensions

More terms from Robert G. Wilson v, Dec 27 2005

A246588 Run Length Transform of S(n) = wt(n) = 0,1,1,2,1,2,2,3,1,... (cf. A000120).

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 2, 1, 2, 1, 1, 1, 1, 1
Offset: 0

Views

Author

N. J. A. Sloane, Sep 05 2014

Keywords

Comments

The Run Length Transform of a sequence {S(n), n>=0} is defined to be the sequence {T(n), n>=0} given by T(n) = Product_i S(i), where i runs through the lengths of runs of 1's in the binary expansion of n. E.g. 19 is 10011 in binary, which has two runs of 1's, of lengths 1 and 2. So T(19) = S(1)*S(2). T(0)=1 (the empty product).

Crossrefs

Cf. A000120.
Run Length Transforms of other sequences: A071053, A227349, A246595, A246596, A246660, A246661, A246674.

Programs

  • Haskell
    import Data.List (group)
    a246588 = product . map (a000120 . length) .
              filter ((== 1) . head) . group . a030308_row
    -- Reinhard Zumkeller, Feb 13 2015, Sep 05 2014
    
  • Maple
    A000120 := proc(n) local w, m, i; w := 0; m :=n; while m > 0 do i := m mod 2; w := w+i; m := (m-i)/2; od; w; end: wt := A000120;
    ans:=[];
    for n from 0 to 100 do lis:=[]; t1:=convert(n, base, 2); L1:=nops(t1); out1:=1; c:=0;
    for i from 1 to L1 do
       if out1 = 1 and t1[i] = 1 then out1:=0; c:=c+1;
       elif out1 = 0 and t1[i] = 1 then c:=c+1;
       elif out1 = 1 and t1[i] = 0 then c:=c;
       elif out1 = 0 and t1[i] = 0 then lis:=[c, op(lis)]; out1:=1; c:=0;
       fi;
       if i = L1 and c>0 then lis:=[c, op(lis)]; fi;
                       od:
    a:=mul(wt(i), i in lis);
    ans:=[op(ans), a];
    od:
    ans;
  • Mathematica
    f[n_] := DigitCount[n, 2, 1]; Table[Times @@ (f[Length[#]]&)  /@ Select[ Split[ IntegerDigits[n, 2]], #[[1]] == 1&], {n, 0, 100}] (* Jean-François Alcover, Jul 11 2017 *)
  • Python
    from operator import mul
    from functools import reduce
    from re import split
    def A246588(n):
        return reduce(mul,(bin(len(d)).count('1') for d in split('0+',bin(n)[2:]) if d)) if n > 0 else 1 # Chai Wah Wu, Sep 07 2014
    
  • Sage
    # uses[RLT from A246660]
    A246588_list = lambda len: RLT(lambda n: sum(Integer(n).digits(2)), len)
    A246588_list(88) # Peter Luschny, Sep 07 2014

A246595 Run Length Transform of squares.

Original entry on oeis.org

1, 1, 1, 4, 1, 1, 4, 9, 1, 1, 1, 4, 4, 4, 9, 16, 1, 1, 1, 4, 1, 1, 4, 9, 4, 4, 4, 16, 9, 9, 16, 25, 1, 1, 1, 4, 1, 1, 4, 9, 1, 1, 1, 4, 4, 4, 9, 16, 4, 4, 4, 16, 4, 4, 16, 36, 9, 9, 9, 36, 16, 16, 25, 36, 1, 1, 1, 4, 1, 1, 4, 9, 1, 1, 1, 4, 4, 4, 9, 16, 1, 1, 1, 4, 1, 1
Offset: 0

Views

Author

N. J. A. Sloane, Sep 06 2014

Keywords

Comments

The Run Length Transform of a sequence {S(n), n>=0} is defined to be the sequence {T(n), n>=0} given by T(n) = Product_i S(i), where i runs through the lengths of runs of 1's in the binary expansion of n. E.g., 19 is 10011 in binary, which has two runs of 1's, of lengths 1 and 2. So T(19) = S(1)*S(2). T(0)=1 (the empty product).

Examples

			From _Omar E. Pol_, Feb 10 2015: (Start)
Written as an irregular triangle in which row lengths is A011782:
1;
1;
1,4;
1,1,4,9;
1,1,1,4,4,4,9,16;
1,1,1,4,1,1,4,9,4,4,4,16,9,9,16,25;
1,1,1,4,1,1,4,9,1,1,1,4,4,4,9,16,4,4,4,16,4,4,16,36,9,9,9,36,16,16,25,36;
...
Right border gives A253909: 1 together with the positive squares.
(End)
From _Omar E. Pol_, Mar 19 2015: (Start)
Also, the sequence can be written as an irregular tetrahedron T(s,r,k) as shown below:
1;
..
1;
..
1;
4;
.......
1,   1;
4;
9;
...............
1,   1,  1,  4;
4,   4;
9;
16;
.............................
1,   1,  1,  4, 1, 1,  4,  9;
4,   4,  4, 16;
9,   9;
16;
25;
......................................................
1,   1,  1,  4, 1, 1,  4,  9, 1, 1, 1, 4, 4, 4, 9, 16;
4,   4,  4, 16, 4, 4, 16, 36;
9,   9,  9, 36;
16, 16;
25;
36;
...
Apart from the initial 1, we have that T(s,r,k) = T(s+1,r,k).
(End)
		

Crossrefs

Cf. A003714 (gives the positions of ones).
Run Length Transforms of other sequences: A071053, A227349, A246588, A246596, A246660, A246661, A246674.

Programs

  • Maple
    ans:=[];
    for n from 0 to 100 do lis:=[]; t1:=convert(n, base, 2); L1:=nops(t1); out1:=1; c:=0;
    for i from 1 to L1 do
       if out1 = 1 and t1[i] = 1 then out1:=0; c:=c+1;
       elif out1 = 0 and t1[i] = 1 then c:=c+1;
       elif out1 = 1 and t1[i] = 0 then c:=c;
       elif out1 = 0 and t1[i] = 0 then lis:=[c, op(lis)]; out1:=1; c:=0;
       fi;
       if i = L1 and c>0 then lis:=[c, op(lis)]; fi;
                       od:
    a:=mul(i^2, i in lis);
    ans:=[op(ans), a];
    od:
    ans;
  • Mathematica
    Table[Times @@ (Length[#]^2&) /@ Select[Split[IntegerDigits[n, 2]], #[[1]] == 1&], {n, 0, 85}] (* Jean-François Alcover, Jul 11 2017 *)
  • Python
    from operator import mul
    from functools import reduce
    from re import split
    def A246595(n):
        return reduce(mul,(len(d)**2 for d in split('0+',bin(n)[2:]) if d != '')) if n > 0 else 1 # Chai Wah Wu, Sep 07 2014
    
  • Sage
    # uses[RLT from A246660]
    A246595_list = lambda len: RLT(lambda n: n^2, len)
    A246595_list(86) # Peter Luschny, Sep 07 2014
    
  • Scheme
    ; using MIT/GNU Scheme
    (define (A246595 n) (fold-left (lambda (a r) (* a r r)) 1 (bisect (reverse (binexp->runcount1list n)) (- 1 (modulo n 2)))))
    ;; Other functions are as in A227349 - Antti Karttunen, Sep 08 2014

Formula

a(n) = A227349(n)^2. - Omar E. Pol, Feb 10 2015

A246596 Run Length Transform of Catalan numbers A000108.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 2, 5, 1, 1, 1, 2, 2, 2, 5, 14, 1, 1, 1, 2, 1, 1, 2, 5, 2, 2, 2, 4, 5, 5, 14, 42, 1, 1, 1, 2, 1, 1, 2, 5, 1, 1, 1, 2, 2, 2, 5, 14, 2, 2, 2, 4, 2, 2, 4, 10, 5, 5, 5, 10, 14, 14, 42, 132, 1, 1, 1, 2, 1, 1, 2, 5, 1, 1, 1, 2, 2, 2, 5, 14, 1, 1, 1, 2, 1, 1, 2, 5
Offset: 0

Views

Author

N. J. A. Sloane, Sep 06 2014

Keywords

Comments

The Run Length Transform of a sequence {S(n), n>=0} is defined to be the sequence {T(n), n>=0} given by T(n) = Product_i S(i), where i runs through the lengths of runs of 1's in the binary expansion of n. E.g. 19 is 10011 in binary, which has two runs of 1's, of lengths 1 and 2. So T(19) = S(1)*S(2). T(0)=1 (the empty product).

Examples

			From _Omar E. Pol_, Feb 15 2015: (Start)
Written as an irregular triangle in which row lengths are the terms of A011782:
1;
1;
1,2;
1,1,2,5;
1,1,1,2,2,2,5,14;
1,1,1,2,1,1,2,5,2,2,2,4,5,5,14,42;
1,1,1,2,1,1,2,5,1,1,1,2,2,2,5,14,2,2,2,4,2,2,4,10,5,5,5,10,14,14,42,132;
...
Right border gives the Catalan numbers. This is simply a restatement of the theorem that this sequence is the Run Length Transform of A000108.
(End)
		

Crossrefs

Cf. A000108.
Cf. A003714 (gives the positions of ones).
Run Length Transforms of other sequences: A005940, A069739, A071053, A227349, A246588, A246595, A246660, A246661, A246674.

Programs

  • Maple
    Cat:=n->binomial(2*n,n)/(n+1);
    ans:=[];
    for n from 0 to 100 do lis:=[]; t1:=convert(n, base, 2); L1:=nops(t1); out1:=1; c:=0;
    for i from 1 to L1 do
    if out1 = 1 and t1[i] = 1 then out1:=0; c:=c+1;
    elif out1 = 0 and t1[i] = 1 then c:=c+1;
    elif out1 = 1 and t1[i] = 0 then c:=c;
    elif out1 = 0 and t1[i] = 0 then lis:=[c, op(lis)]; out1:=1; c:=0;
    fi;
    if i = L1 and c>0 then lis:=[c, op(lis)]; fi;
    od:
    a:=mul(Cat(i), i in lis);
    ans:=[op(ans), a];
    od:
    ans;
  • Mathematica
    f = CatalanNumber; Table[Times @@ (f[Length[#]]&) /@ Select[ Split[ IntegerDigits[n, 2]], #[[1]] == 1&], {n, 0, 87}] (* Jean-François Alcover, Jul 11 2017 *)
  • Python
    from operator import mul
    from functools import reduce
    from gmpy2 import divexact
    from re import split
    def A246596(n):
        s, c = bin(n)[2:], [1, 1]
        for m in range(1, len(s)):
            c.append(divexact(c[-1]*(4*m+2),(m+2)))
        return reduce(mul,(c[len(d)] for d in split('0+',s))) if n > 0 else 1
    # Chai Wah Wu, Sep 07 2014
    
  • Sage
    # uses[RLT from A246660]
    A246596_list = lambda len: RLT(lambda n: binomial(2*n, n)/(n+1), len)
    A246596_list(88) # Peter Luschny, Sep 07 2014
    
  • Scheme
    ; using MIT/GNU Scheme
    (define (A246596 n) (fold-left (lambda (a r) (* a (A000108 r))) 1 (bisect (reverse (binexp->runcount1list n)) (- 1 (modulo n 2)))))
    (define A000108 (EIGEN-CONVOLUTION 1 *))
    ;; Note: EIGEN-CONVOLUTION can be found from my IntSeq-library and other functions are as in A227349. - Antti Karttunen, Sep 08 2014

Formula

a(n) = A069739(A005940(1+n)). - Antti Karttunen, May 29 2017

A246674 Run Length Transform of A000225.

Original entry on oeis.org

1, 1, 1, 3, 1, 1, 3, 7, 1, 1, 1, 3, 3, 3, 7, 15, 1, 1, 1, 3, 1, 1, 3, 7, 3, 3, 3, 9, 7, 7, 15, 31, 1, 1, 1, 3, 1, 1, 3, 7, 1, 1, 1, 3, 3, 3, 7, 15, 3, 3, 3, 9, 3, 3, 9, 21, 7, 7, 7, 21, 15, 15, 31, 63, 1, 1, 1, 3, 1, 1, 3, 7, 1, 1, 1, 3, 3, 3, 7, 15, 1, 1, 1, 3, 1, 1, 3, 7, 3, 3, 3, 9, 7, 7, 15, 31, 3, 3, 3, 9, 3, 3, 9, 21, 3, 3, 3, 9, 9, 9, 21, 45, 7, 7, 7, 21, 7, 7, 21, 49, 15, 15, 15, 45, 31, 31, 63, 127, 1
Offset: 0

Views

Author

Antti Karttunen, Sep 08 2014

Keywords

Comments

a(n) can be also computed by replacing all consecutive runs of zeros in the binary expansion of n with * (multiplication sign), and then performing that multiplication, still in binary, after which the result is converted into decimal. See the example below.

Examples

			115 is '1110011' in binary. The run lengths of 1-runs are 2 and 3, thus a(115) = A000225(2) * A000225(3) = ((2^2)-1) * ((2^3)-1) = 3*7 = 21.
The same result can be also obtained more directly, by realizing that '111' and '11' are the binary representations of 7 and 3, and 7*3 = 21.
From _Omar E. Pol_, Feb 15 2015: (Start)
Written as an irregular triangle in which row lengths are the terms of A011782:
1;
1;
1,3;
1,1,3,7;
1,1,1,3,3,3,7,15;
1,1,1,3,1,1,3,7,3,3,3,9,7,7,15,31;
1,1,1,3,1,1,3,7,1,1,1,3,3,3,7,15,3,3,3,9,3,3,9,21,7,7,7,21,15,15,31,63;
...
Right border gives 1 together with the positive terms of A000225.
(End)
		

Crossrefs

Cf. A003714 (gives the positions of ones).
A001316 is obtained when the same transformation is applied to A000079, the powers of two.
Run Length Transforms of other sequences: A071053, A227349, A246588, A246595, A246596, A246660, A246661, A246685, A247282.

Programs

  • Mathematica
    f[n_] := 2^n - 1; Table[Times @@ (f[Length[#]]&) /@ Select[ Split[ IntegerDigits[n, 2]], #[[1]] == 1&], {n, 0, 100}] (* Jean-François Alcover, Jul 11 2017 *)
  • Python
    # uses RLT function in A278159
    def A246674(n): return RLT(n,lambda m: 2**m-1) # Chai Wah Wu, Feb 04 2022

Formula

For all n >= 0, a(A051179(n)) = A247282(A051179(n)) = A051179(n).

A278159 Run length transform of primorials, A002110.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Nov 16 2016

Keywords

Comments

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

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.
		

Crossrefs

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.
    

Formula

a(n) = A124859(A005940(1+n)).
Showing 1-10 of 15 results. Next