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.

Previous Showing 21-30 of 106 results. Next

A089625 Replace 2^k in binary expansion of n with (k+1)-st prime.

Original entry on oeis.org

2, 3, 5, 5, 7, 8, 10, 7, 9, 10, 12, 12, 14, 15, 17, 11, 13, 14, 16, 16, 18, 19, 21, 18, 20, 21, 23, 23, 25, 26, 28, 13, 15, 16, 18, 18, 20, 21, 23, 20, 22, 23, 25, 25, 27, 28, 30, 24, 26, 27, 29, 29, 31, 32, 34, 31, 33, 34, 36, 36, 38, 39, 41, 17, 19, 20, 22, 22, 24, 25, 27
Offset: 1

Views

Author

Reinhard Zumkeller, Dec 31 2003

Keywords

Examples

			n=25 -> '11001': a(25) = 1*11 + 1*7 + 0*5 + 0*3 + 1*2 = 20.
This sequence regarded as a triangle with rows of lengths  1, 2, 4, 8, 16, ...:
  2
  3, 5
  5, 7, 8, 10
  7, 9, 10, 12, 12, 14, 15, 17
  11, 13, 14, 16, 16, 18, 19, 21, 18, 20, 21, 23, 23, 25, 26, 28
  ... - _Philippe Deléham_, Jun 07 2015
		

Crossrefs

Other sequences that are built by replacing 2^k in the binary representation with other numbers: A029931 (natural numbers), A059590 (factorials), A022290 (Fibonacci).

Programs

  • Haskell
    a089625 n = f n 0 a000040_list where
       f 0 y _      = y
       f x y (p:ps) = f x' (y + p * r) ps where (x',r) = divMod x 2
    -- Reinhard Zumkeller, Oct 03 2012
    
  • Maple
    f:= proc(n) local L,j;
      L:= convert(n,base,2);
      add(L[i]*ithprime(i),i=1..nops(L))
    end proc:
    map(f, [$1..100]); # Robert Israel, Jun 08 2015
  • Mathematica
    a[n_] := With[{bb = IntegerDigits[n, 2]}, bb.Prime[Range[Length[bb], 1, -1]]];
    Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Oct 27 2021 *)
  • PARI
    a(n)=my(v=Vecrev(binary(n)),s,i);forprime(p=2,prime(#v),s+=v[i++]*p);s \\ Charles R Greathouse IV, Sep 23 2012
    
  • Python
    from sympy import nextprime
    def A089625(n):
        c, p = 0, 2
        while n:
            if n&1:
                c += p
            n >>=1
            p = nextprime(p)
        return c # Chai Wah Wu, Aug 09 2023

Formula

a(n) = Sum_{i=0..L(n)-1} b(i)*prime(i+1) where L=A070939 and b is defined by n = Sum_{i=0..L(n)-1} b(i)*2^i.
G.f.: 1/(1-x) * Sum_{k>=0} prime(k+1)*x^2^k/(1+x^2^k).
a(A000079(n)) = A000040(n+1).
a(A000225(n)) = A007504(n).
A000586(n) > 0 iff n = a(m) for some m.
a(n) = n for n = 9, 10, or 12.
a(n) = Sum_{k>=0} A030308(n,k)*A000040(k+1). - Philippe Deléham, Oct 15 2011
log n log log n << a(n) << log^2 n log log n. - Charles R Greathouse IV, Sep 23 2012
For n >= 8, a(n) <= m*(m+1)*(log(m)+log(log(m)))/2 where m = ceiling(log_2(n)). - Robert Israel, Jun 08 2015
a(n) = A001414(A019565(n)) = A008472(A019565(n)) for n>=1. - Flávio V. Fernandes, Feb 24 2025

A350457 Maximal coefficient of (1 + x^2) * (1 + x^3) * (1 + x^5) * ... * (1 + x^prime(n)).

Original entry on oeis.org

1, 1, 1, 2, 2, 2, 4, 4, 7, 10, 16, 27, 45, 79, 139, 249, 439, 784, 1419, 2574, 4703, 8682, 16021, 29720, 55146, 102170, 190274, 356804, 671224, 1269022, 2404289, 4521836, 8535117, 16134474, 30635869, 58062404, 110496946, 210500898, 401422210, 767158570, 1467402238
Offset: 0

Views

Author

Ilya Gutkovskiy, Jan 01 2022

Keywords

Crossrefs

Programs

  • Maple
    b:= proc(n) option remember; `if`(n=0, 1,
          expand((1+x^ithprime(n))*b(n-1)))
        end:
    a:= n-> max(coeffs(b(n))):
    seq(a(n), n=0..40);  # Alois P. Heinz, Jan 01 2022
  • Mathematica
    b[n_] := b[n] = If[n == 0, 1, Expand[(1 + x^Prime[n])*b[n - 1]]];
    a[n_] := Max[CoefficientList[b[n], x]];
    Table[a[n], {n, 0, 40}] (* Jean-François Alcover, Feb 26 2022, after Alois P. Heinz *)
  • PARI
    a(n) = vecmax(Vec(prod(k=1, n, 1 + x^prime(k)))); \\ Michel Marcus, Jan 01 2022
    
  • Python
    from sympy.abc import x
    from sympy import prime, prod
    def A350457(n): return 1 if n == 0 else max(prod(1+x**prime(i) for i in range(1,n+1)).as_poly().coeffs()) # Chai Wah Wu, Jan 03 2022

A379300 Number of prime indices of n that are composite.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, Dec 25 2024

Keywords

Comments

A prime index of n is a number m such that prime(m) divides n. The multiset of prime indices of n is row n of A112798.

Examples

			The prime indices of 39 are {2,6}, so a(39) = 1.
The prime indices of 70 are {1,3,4}, so a(70) = 1.
The prime indices of 98 are {1,4,4}, so a(98) = 2.
The prime indices of 294 are {1,2,4,4}, a(294) = 2.
The prime indices of 1911 are {2,4,4,6}, so a(1911) = 3.
The prime indices of 2548 are {1,1,4,4,6}, so a(2548) = 3.
		

Crossrefs

Positions of first appearances are A000420.
Positions of zero are A302540, counted by A034891 (strict A036497).
Positions of one are A379301, counted by A379302 (strict A379303).
A000040 lists the prime numbers, differences A001223.
A002808 lists the composite numbers, nonprimes A018252, differences A073783 or A065310.
A055396 gives least prime index, greatest A061395.
A056239 adds up prime indices, row sums of A112798, counted by A001222.
A066247 is the characteristic function for the composite numbers.
A377033 gives k-th differences of composite numbers, see A073445, A377034-A377037.
Other counts of prime indices:
- A087436 postpositive, see A038550.
- A330944 nonprime, see A002095, A096258, A320628, A330945.
- A379306 squarefree, see A302478, A379308, A379309, A379316.
- A379310 nonsquarefree, see A114374, A256012, A379307.
- A379311 old prime, see A379312-A379315.

Programs

  • Mathematica
    prix[n_]:=If[n==1,{},Flatten[Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]]];
    Table[Length[Select[prix[n],CompositeQ]],{n,100}]

Formula

Totally additive with a(prime(k)) = A066247(k).

A379311 Number of prime indices of n that are 1 or prime.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, Dec 27 2024

Keywords

Comments

A prime index of n is a number m such that prime(m) divides n. The multiset of prime indices of n is row n of A112798.

Examples

			The prime indices of 39 are {2,6}, so a(39) = 1.
The prime indices of 70 are {1,3,4}, so a(70) = 2.
The prime indices of 98 are {1,4,4}, so a(98) = 1.
The prime indices of 294 are {1,2,4,4}, a(294) = 2.
The prime indices of 1911 are {2,4,4,6}, so a(1911) = 1.
The prime indices of 2548 are {1,1,4,4,6}, so a(2548) = 2.
		

Crossrefs

Positions of first appearances are A000079.
These "old" primes are listed by A008578.
Positions of zero are A320629, counted by A023895 (strict A204389).
Positions of one are A379312, counted by A379314 (strict A379315).
Positions of nonzero terms are A379313.
A000040 lists the prime numbers, differences A001223.
A002808 lists the composite numbers, nonprimes A018252, differences A073783 or A065310.
A055396 gives least prime index, greatest A061395.
A056239 adds up prime indices, row sums of A112798, counted by A001222.
A080339 is the characteristic function for the old prime numbers.
A376682 gives k-th differences of old prime numbers, see A030016, A075526, A173390, A376683, A376855.
Other counts of prime indices:
- A330944 nonprime, see A002095, A096258, A320628, A330945.
- A379306 squarefree, see A302478, A379308, A379309, A379316.
- A379310 nonsquarefree, see A114374, A256012, A379307.

Programs

  • Mathematica
    prix[n_]:=If[n==1,{},Flatten[Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]]];
    Table[Length[Select[prix[n],#==1||PrimeQ[#]&]],{n,100}]

Formula

Totally additive with a(prime(k)) = A080339(k).

A379314 Number of integer partitions of n with a unique 1 or prime part.

Original entry on oeis.org

0, 1, 1, 1, 0, 2, 1, 3, 1, 4, 3, 8, 3, 10, 6, 14, 8, 22, 12, 30, 18, 40, 26, 58, 33, 76, 53, 103, 69, 140, 94, 185, 132, 239, 176, 323, 232, 417, 320, 536, 414, 704, 544, 900, 721, 1145, 936, 1481, 1198, 1867, 1571, 2363, 2001, 3003, 2550, 3768, 3275, 4712
Offset: 0

Views

Author

Gus Wiseman, Dec 28 2024

Keywords

Examples

			The a(10) = 3 through a(15) = 14 partitions:
  (8,2)    (11)     (9,3)    (13)       (9,5)      (8,7)
  (9,1)    (6,5)    (10,2)   (7,6)      (12,2)     (10,5)
  (4,4,2)  (7,4)    (6,4,2)  (8,5)      (6,6,2)    (11,4)
           (8,3)             (10,3)     (8,4,2)    (12,3)
           (9,2)             (12,1)     (9,4,1)    (14,1)
           (10,1)            (5,4,4)    (4,4,4,2)  (6,5,4)
           (4,4,3)           (6,4,3)               (6,6,3)
           (6,4,1)           (6,6,1)               (7,4,4)
                             (8,4,1)               (8,4,3)
                             (4,4,4,1)             (8,6,1)
                                                   (9,4,2)
                                                   (10,4,1)
                                                   (4,4,4,3)
                                                   (6,4,4,1)
		

Crossrefs

For all prime parts we have A000607 (strict A000586), ranks A076610.
For no prime parts we have A002095 (strict A096258), ranks A320628.
Ranked by A379312 = positions of 1 in A379311.
For a unique composite part we have A379302 (strict A379303), ranks A379301.
The strict case is A379315.
For squarefree instead of old prime we have A379308 (strict A379309), ranks A379316.
Considering 1 nonprime gives A379304 (strict A379305), ranks A331915.
A000040 lists the prime numbers, differences A001223.
A000041 counts integer partitions, strict A000009.
A002808 lists the composite numbers, nonprimes A018252, differences A073783 or A065310.
A376682 gives k-th differences of old primes.

Programs

  • Mathematica
    Table[Length[Select[IntegerPartitions[n],Count[#,_?(#==1||PrimeQ[#]&)]==1&]],{n,0,30}]
  • PARI
    seq(n)={Vec(sum(k=1, n, if(isprime(k) || k==1, x^k))/prod(k=4, n, 1 - if(!isprime(k), x^k), 1 + O(x^n)), -n-1)} \\ Andrew Howroyd, Dec 28 2024

A024939 Number of partitions of n into distinct odd primes.

Original entry on oeis.org

1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 3, 3, 2, 3, 3, 3, 4, 3, 5, 4, 4, 5, 5, 6, 6, 5, 7, 7, 7, 8, 8, 9, 8, 9, 11, 11, 10, 12, 12, 13, 14, 14, 16, 15, 16, 17, 19, 20, 20, 20, 22, 24, 23, 26, 27, 27, 28, 30, 33, 34, 34, 36, 37, 40, 41, 43, 46, 46, 47, 50, 55, 56, 56
Offset: 0

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    a024939 = p a065091_list where
       p _  0 = 1
       p (k:ks) m = if m < k then 0 else p ks (m - k) + p ks m
    -- Reinhard Zumkeller, Aug 05 2012

Formula

G.f.: Product_{k>1} (1+x^prime(k)).

Extensions

Corrected and extended by Vladeta Jovovic, Jul 20 2003

A184171 Number of partitions of n into an even number of distinct primes.

Original entry on oeis.org

1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 2, 1, 2, 1, 2, 2, 2, 2, 3, 3, 3, 2, 3, 3, 3, 4, 4, 5, 5, 4, 6, 5, 5, 6, 7, 7, 8, 7, 9, 8, 9, 8, 11, 11, 12, 10, 13, 12, 14, 14, 15, 16, 17, 16, 20, 19, 20, 20, 24, 22, 26, 23, 27, 27, 30, 28, 34, 33, 36, 34, 40, 37, 43, 41, 46, 46, 50, 47, 56, 55
Offset: 0

Views

Author

Emeric Deutsch, (suggested by R. J. Mathar), Jan 09 2011

Keywords

Examples

			a(33) = 5 because we have [31,2], [23,5,3,2], [19,7,5,2], [17,11,3,2], and [13,11,7,2].
		

Crossrefs

Programs

  • Maple
    g := 1/2*(Product(1+z^ithprime(k), k = 1 .. 120)+Product(1-z^ithprime(k), k = 1 .. 120)): gser := series(g, z = 0, 110): seq(coeff(gser, z, n), n = 0 .. 85);
    # second Maple program
    with(numtheory):
    b:= proc(n, i) option remember;
          `if`(n=0, [1], `if`(i<1, [], zip((x, y)->x+y, b(n, i-1),
           [0, `if`(ithprime(i)>n, [], b(n-ithprime(i), i-1))[]], 0)))
        end:
    a:= proc(n) local l; l:= b(n, pi(n));
          add(l[2*i-1], i=1..iquo(nops(l)+1,2))
        end:
    seq(a(n), n=0..100);  # Alois P. Heinz, Nov 15 2012
  • Mathematica
    b[n_, i_] := b[n, i] = If[n == 0, {1}, If[i<1, {}, Plus @@ PadRight[{b[n, i-1], Join[{0}, If[Prime[i]>n, {}, b[n-Prime[i], i-1]]]}]]]; a[n_] := Module[{l}, l = b[n, PrimePi[n]]; Sum[l[[2*i-1]], {i, 1, Quotient[Length[l]+1, 2]}]]; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Jan 30 2014, after Alois P. Heinz *)
  • PARI
    parts(n, pred, y)={prod(k=1, n, 1 + if(pred(k), y*x^k + O(x*x^n), 0))}
    {my(n=80); Vec(parts(n, isprime, 1) + parts(n, isprime, -1))/2} \\ Andrew Howroyd, Dec 28 2017

Formula

G.f.: (1/2)*[Product_{k>=1} (1+z^prime(k)) + Product_{k>=1} (1-z^prime(k))].
a(n) = Sum_{k>=0} A219180(n,2*k). - Alois P. Heinz, Nov 15 2012
a(n) + A184172(n) = A000586(n). - R. J. Mathar, Mar 31 2023

A184172 Number of partitions of n into an odd number of distinct primes.

Original entry on oeis.org

0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 2, 2, 3, 3, 3, 4, 3, 5, 3, 4, 4, 5, 5, 6, 6, 7, 5, 7, 7, 8, 8, 8, 9, 11, 9, 10, 11, 12, 12, 14, 13, 16, 14, 16, 15, 19, 17, 20, 20, 22, 20, 23, 24, 27, 26, 28, 27, 33, 30, 34, 34, 37, 36, 41, 40, 46, 43, 47, 46, 55, 50, 56
Offset: 0

Views

Author

Emeric Deutsch (suggested by R. J. Mathar), Jan 09 2011

Keywords

Examples

			a(33) = 4 because we have [23,7,3], [19,11,3], [17,13,3], and [17,11,5].
		

Crossrefs

Programs

  • Maple
    g := 1/2*(Product(1+z^ithprime(k), k = 1 .. 120)-Product(1-z^ithprime(k), k = 1 .. 120)): gser := series(g, z = 0, 110): seq(coeff(gser, z, n), n = 0 .. 85);
    # second Maple program
    with(numtheory):
    b:= proc(n, i) option remember;
          `if`(n=0, [1], `if`(i<1, [], zip((x, y)->x+y, b(n, i-1),
           [0, `if`(ithprime(i)>n, [], b(n-ithprime(i), i-1))[]], 0)))
        end:
    a:= proc(n) local l; l:= b(n, pi(n));
          add(l[2*i], i=1..iquo(nops(l), 2))
        end:
    seq(a(n), n=0..100);  # Alois P. Heinz, Nov 15 2012
  • Mathematica
    b[n_, i_] := b[n, i] = If[n == 0, {1}, If[i<1, {}, Plus @@ PadRight[{b[n, i-1], Join[{0}, If[Prime[i]>n, {}, b[n-Prime[i], i-1]]]}]]]; a[n_] := Module[{l}, l = b[n, PrimePi[n]]; Sum[l[[2*i]], {i, 1, Quotient[Length[l], 2]}]]; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Jan 30 2014, after Alois P. Heinz *)
  • PARI
    parts(n, pred, y)={prod(k=1, n, 1 + if(pred(k), y*x^k + O(x*x^n), 0))}
    {my(n=80); (Vec(parts(n, isprime, 1)) - Vec(parts(n, isprime, -1)))/2} \\ Andrew Howroyd, Dec 28 2017

Formula

G.f.: (1/2)*[Product_{k>=1} (1+z^prime(k)) - Product_{k>=1} (1-z^prime(k))].
a(n) = Sum_{k>=0} A219180(n,2*k+1). - Alois P. Heinz, Nov 15 2012
a(n) + A184171(n) = A000586(n). - R. J. Mathar, Mar 31 2023

A379302 Number of integer partitions of n with a unique composite part.

Original entry on oeis.org

0, 0, 0, 0, 1, 1, 3, 4, 7, 11, 16, 23, 32, 43, 58, 77, 100, 129, 164, 207, 259, 323, 398, 489, 595, 723, 872, 1049, 1255, 1495, 1774, 2097, 2472, 2903, 3399, 3969, 4618, 5362, 6210, 7173, 8268, 9506, 10907, 12488, 14271, 16278, 18532, 21061, 23893, 27064
Offset: 0

Views

Author

Gus Wiseman, Dec 25 2024

Keywords

Examples

			The a(0) = 0 through a(9) = 11 partitions:
  .  .  .  .  (4)  (41)  (6)    (43)    (8)      (9)
                         (42)   (61)    (62)     (54)
                         (411)  (421)   (422)    (63)
                                (4111)  (431)    (81)
                                        (611)    (432)
                                        (4211)   (621)
                                        (41111)  (4221)
                                                 (4311)
                                                 (6111)
                                                 (42111)
                                                 (411111)
		

Crossrefs

If all parts are composite we have A023895 (strict A204389), ranks A320629.
If no parts are composite we have A034891 (strict A036497), ranks A302540.
Ranked by A379301 = positions of 1 in A379300.
The strict case is A379303.
For a unique prime part we have A379304 (strict A379305), ranks A331915.
A000041 counts integer partitions, strict A000009.
A002808 lists the composite numbers, nonprimes A018252.
A066247 is the characteristic function for the composite numbers.
A377033 gives k-th differences of composite numbers.

Programs

  • Mathematica
    Table[Length[Select[IntegerPartitions[n],Count[#,_?CompositeQ]==1&]],{n,0,30}]

A379307 Positive integers whose prime indices include no squarefree numbers.

Original entry on oeis.org

1, 7, 19, 23, 37, 49, 53, 61, 71, 89, 97, 103, 107, 131, 133, 151, 161, 173, 193, 197, 223, 227, 229, 239, 251, 259, 263, 281, 307, 311, 337, 343, 359, 361, 371, 379, 383, 409, 419, 427, 433, 437, 457, 463, 479, 497, 503, 521, 523, 529, 541, 569, 593, 613, 623
Offset: 1

Views

Author

Gus Wiseman, Dec 27 2024

Keywords

Comments

A prime index of n is a number m such that prime(m) divides n. The multiset of prime indices of n is row n of A112798.

Examples

			The terms together with their prime indices begin:
    1: {}
    7: {4}
   19: {8}
   23: {9}
   37: {12}
   49: {4,4}
   53: {16}
   61: {18}
   71: {20}
   89: {24}
   97: {25}
  103: {27}
  107: {28}
  131: {32}
  133: {4,8}
  151: {36}
  161: {4,9}
  173: {40}
		

Crossrefs

Partitions of this type are counted by A114374, strict A256012.
Positions of zero in A379306.
For a unique squarefree part we have A379316, counted by A379308 (strict A379309).
A000040 lists the primes, differences A001223.
A005117 lists the squarefree numbers, differences A076259.
A008966 is the characteristic function for the squarefree numbers.
A013929 lists the nonsquarefree numbers, differences A078147.
A055396 gives least prime index, greatest A061395.
A056239 adds up prime indices, row sums of A112798, counted by A001222.
A061398 counts squarefree numbers between primes, zeros A068360.
A377038 gives k-th differences of squarefree numbers.
Other counts of prime indices:
- A330944 nonprime, see A000586, A000607, A076610, A330945.
- A379310 nonsquarefree, see A302478.
- A379311 old prime, see A204389, A320629, A379312-A379315.

Programs

  • Mathematica
    prix[n_]:=If[n==1,{},Flatten[Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]]];
    Select[Range[1000],Length[Select[prix[#],SquareFreeQ]]==0&]
Previous Showing 21-30 of 106 results. Next