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 86 results. Next

A118256 Concatenation for i=1 to n of A005171(i); also A118255 in base 2.

Original entry on oeis.org

1, 10, 100, 1001, 10010, 100101, 1001010, 10010101, 100101011, 1001010111, 10010101110, 100101011101, 1001010111010, 10010101110101, 100101011101011, 1001010111010111, 10010101110101110, 100101011101011101, 1001010111010111010, 10010101110101110101, 100101011101011101011
Offset: 1

Views

Author

Pierre CAMI, Apr 19 2006

Keywords

Examples

			A005171 : 1,0,0,1,0,1,0,1,1,1,0,1,0,1,1,1,0,1,0,1,1,1,0,1,1 ................
a(1)=1, a(2)=10, a(3)=100, a(4)=1001, ...
		

Crossrefs

Programs

  • Mathematica
    Array[FromDigits@ Array[Boole[! PrimeQ@ #] &, #] &, 21] (* or *)
    FromDigits@ IntegerDigits[#, 2] & /@ Last@ Transpose@ NestList[{#1 + 1, If[PrimeQ[#1 + 1], 2 #2, 2 #2 + 1]} & @@ # &, {1, 1}, 21] (* Michael De Vlieger, Nov 01 2016, latter after Harvey P. Dale at A118255 *)
  • PARI
    a(n) = sum(k=1, n, !isprime(k)*10^(n-k)); \\ Michel Marcus, Nov 01 2016
    
  • Python
    from sympy import isprime
    def a(n): return int("".join(str(1-isprime(i)) for i in range(1, n+1)))
    print([a(n) for n in range(1, 22)]) # Michael S. Branicky, Jan 10 2022
    
  • Python
    # faster version for initial segment of sequence
    from sympy import isprime
    from itertools import count, islice
    def agen(): # generator of terms
        an = 0
        for k in count(1):
            an = 10 * an + int(not isprime(k))
            yield an
    print(list(islice(agen(), 21))) # Michael S. Branicky, Jan 10 2022

Formula

a(n) ~ 10^n * 0.10010101.... [Charles R Greathouse IV, Dec 27 2011]

Extensions

Corrected by Omar E. Pol, Nov 08 2007

A346482 Dirichlet inverse of A005171, the characteristic function of nonprimes.

Original entry on oeis.org

1, 0, 0, -1, 0, -1, 0, -1, -1, -1, 0, -1, 0, -1, -1, 0, 0, -1, 0, -1, -1, -1, 0, 1, -1, -1, -1, -1, 0, -1, 0, 1, -1, -1, -1, 2, 0, -1, -1, 1, 0, -1, 0, -1, -1, -1, 0, 3, -1, -1, -1, -1, 0, 1, -1, 1, -1, -1, 0, 3, 0, -1, -1, 1, -1, -1, 0, -1, -1, -1, 0, 5, 0, -1, -1, -1, -1, -1, 0, 3, 0, -1, 0, 3, -1, -1, -1, 1, 0, 3
Offset: 1

Views

Author

Mats Granvik and Antti Karttunen, Aug 17 2021

Keywords

Comments

In addition to A168645, -1's occur also in the following positions: 256, 512, 6561, 16384, 19683, 32768, 390625, 1048576, ...

Crossrefs

Union of A000040 and A346484 gives the positions of zeros.

Programs

  • PARI
    up_to = 65537;
    DirInverseCorrect(v) = { my(u=vector(#v)); u[1] = (1/v[1]); for(n=2, #v, u[n] = (-u[1]*sumdiv(n, d, if(dA005171(n) = (1-isprime(n));
    v346482 = DirInverseCorrect(vector(up_to,n,A005171(n)));
    A346482(n) = v346482[n];

Formula

a(1) = 1; and for n > 2, a(n) = -Sum_{d|n, dA005171(n/d).
a(n) = A346483(n) - A005171(n).

A346483 Sum of A005171 (characteristic function of nonprimes) and its Dirichlet inverse.

Original entry on oeis.org

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

Views

Author

Mats Granvik and Antti Karttunen, Aug 17 2021

Keywords

Comments

The first negative term is a(192) = -1.
Positions of nonzero terms are given by A033987, except for positions n = 256, 512, 6561, 16384, 19683, 32768, 390625, 1048576, ..., at which a(n) = 0 also.

Crossrefs

Programs

  • Mathematica
    nn = 87; b = Table[If[PrimeQ[n], 1, 0], {n, nn}]; a = 1 - b; A = Table[Table[If[Mod[n, k] == 0, a[[n/k]], 0], {k, 1, nn}], {n, 1, nn}]; B = Inverse[A]; S = A[[Range[nn]]] + B[[Range[nn]]]; S[[All, 1]]
  • PARI
    up_to = 65537;
    DirInverseCorrect(v) = { my(u=vector(#v)); u[1] = (1/v[1]); for(n=2, #v, u[n] = (-u[1]*sumdiv(n, d, if(dA005171(n) = (1-isprime(n));
    v346482 = DirInverseCorrect(vector(up_to,n,A005171(n)));
    A346482(n) = v346482[n];
    A346483(n) = (A005171(n)+A346482(n));

Formula

a(n) = A005171(n) + A346482(n).
For n > 1, a(n) = -Sum_{d|n, 1A005171(d) * A346482(n/d).

A001055 The multiplicative partition function: number of ways of factoring n with all factors greater than 1 (a(1) = 1 by convention).

Original entry on oeis.org

1, 1, 1, 2, 1, 2, 1, 3, 2, 2, 1, 4, 1, 2, 2, 5, 1, 4, 1, 4, 2, 2, 1, 7, 2, 2, 3, 4, 1, 5, 1, 7, 2, 2, 2, 9, 1, 2, 2, 7, 1, 5, 1, 4, 4, 2, 1, 12, 2, 4, 2, 4, 1, 7, 2, 7, 2, 2, 1, 11, 1, 2, 4, 11, 2, 5, 1, 4, 2, 5, 1, 16, 1, 2, 4, 4, 2, 5, 1, 12, 5, 2, 1, 11, 2, 2, 2, 7, 1, 11, 2, 4, 2, 2, 2, 19, 1, 4, 4, 9, 1, 5, 1
Offset: 1

Views

Author

Keywords

Comments

From David W. Wilson, Feb 28 2009: (Start)
By a factorization of n we mean a multiset of integers > 1 whose product is n.
For example, 6 is the product of 2 such multisets, {2, 3} and {6}, so a(6) = 2.
Similarly 8 is the product of 3 such multisets, {2, 2, 2}, {2, 4} and {8}, so a(8) = 3.
1 is the product of 1 such multiset, namely the empty multiset {}, whose product is by definition the multiplicative identity 1. Hence a(1) = 1. (End)
a(n) = # { k | A064553(k) = n }. - Reinhard Zumkeller, Sep 21 2001; Benoit Cloitre and N. J. A. Sloane, May 15 2002
Number of members of A025487 with n divisors. - Matthew Vandermast, Jul 12 2004
See sequence A162247 for a list of the factorizations of n and a program for generating the factorizations for any n. - T. D. Noe, Jun 28 2009
So a(n) gives the number of different prime signatures that can be found among the integers that have n divisors. - Michel Marcus, Nov 11 2015
For n > 0, also the number of integer partitions of n with product n, ranked by A301987. For example, the a(12) = 4 partitions are: (12), (6,2,1,1,1,1), (4,3,1,1,1,1,1), (3,2,2,1,1,1,1,1). See also A380218. In general, A379666(m,n) = a(n) for any m >= n. - Gus Wiseman, Feb 07 2025

Examples

			1: 1, a(1) = 1
2: 2, a(2) = 1
3: 3, a(3) = 1
4: 4 = 2*2, a(4) = 2
6: 6 = 2*3, a(6) = 2
8: 8 = 2*4 = 2*2*2, a(8) = 3
etc.
		

References

  • M. Abramowitz and I. A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards Applied Math. Series 55, 1964 (and various reprintings), p. 844.
  • S. R. Finch, Mathematical Constants, Cambridge, 2003, pp. 292-295.
  • Amarnath Murthy and Charles Ashbacher, Generalized Partitions and Some New Ideas on Number Theory and Smarandache Sequences, Hexis, Phoenix; USA 2005. See Section 1.4.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • G. Tenenbaum, Introduction to analytic and probabilistic number theory, Cambridge University Press, 1995, p. 198, exercise 9 (in the third edition 2015, p. 296, exercise 211).

Crossrefs

A045782 gives the range of a(n).
For records see A033833, A033834.
Row sums of A316439 (for n>1).
Cf. A096276 (partial sums).
The additive version is A000041 (integer partitions), strict A000009.
Row sums of A318950.
A002865 counts partitions into parts > 1.
A069016 counts distinct sums of factorizations.
A319000 counts partitions by product and sum, row sums A319916.
A379666 (transpose A380959) counts partitions by sum and product, without 1's A379668, strict A379671.

Programs

  • Haskell
    a001055 = (map last a066032_tabl !!) . (subtract 1)
    -- Reinhard Zumkeller, Oct 01 2012
    
  • Java
    public class MultiPart {
        public static void main(String[] argV) {
            for (int i=1;i<=100;++i) System.out.println(1+getDivisors(2,i));
        }
        public static int getDivisors(int min,int n) {
            int total = 0;
            for (int i=min;i=i) { ++total; if (n/i>i) total+=getDivisors(i,n/i); }
            return total;
        }
    } \\ Scott R. Shannon, Aug 21 2019
  • Maple
    with(numtheory):
    T := proc(n::integer, m::integer)
            local A, summe, d:
            if isprime(n) then
                    if n <= m then
                            return 1;
                    end if:
                    return 0 ;
            end if:
            A := divisors(n) minus {n, 1}:
            for d in A do
                    if d > m then
                            A := A minus {d}:
                    end if:
            end do:
            summe := add(T(n/d,d),d=A) ;
            if n <=m then
                    summe := summe + 1:
            end if:
            summe ;
    end proc:
    A001055 := n -> T(n, n):
    [seq(A001055(n), n=1..100)]; # Reinhard Zumkeller and Ulrich Schimke (ulrschimke(AT)aol.com)
  • Mathematica
    c[1, r_] := c[1, r]=1; c[n_, r_] := c[n, r] = Module[{ds, i}, ds = Select[Divisors[n], 1 < # <= r &]; Sum[c[n/ds[[i]], ds[[i]]], {i, 1, Length[ds]}]]; a[n_] := c[n, n]; a/@Range[100] (* c[n, r] is the number of factorizations of n with factors <= r. - Dean Hickerson, Oct 28 2002 *)
    T[, 1] = T[1, ] = 1;
    T[n_, m_] := T[n, m] = DivisorSum[n, Boole[1 < # <= m] * T[n/#, #]&];
    a[n_] := T[n, n];
    a /@ Range[100] (* Jean-François Alcover, Jan 03 2020 *)
  • PARI
    /* factorizations of n with factors <= m (n,m positive integers) */
    fcnt(n,m) = {local(s);s=0;if(n == 1,s=1,fordiv(n,d,if(d > 1 & d <= m,s=s+fcnt(n/d,d))));s}
    A001055(n) = fcnt(n,n) \\ Michael B. Porter, Oct 29 2009
    
  • PARI
    \\ code using Dirichlet g.f., based on Somos's code for A007896
    {a(n) = my(A, v, w, m);
    if(
    n<1, 0,
    \\ define unit vector v = [1, 0, 0, ...] of length n
    v = vector(n, k, k==1);
    for(k=2, n,
    m = #digits(n, k) - 1;
    \\ expand 1/(1-x)^k out far enough
    A = (1 - x)^ -1 + x * O(x^m);
    \\ w = zero vector of length n
    w = vector(n);
    \\ convert A to a vector
    for(i=0, m, w[k^i] = polcoeff(A, i));
    \\ build the answer
    v = dirmul(v, w)
    );
    v[n]
    )
    };
    \\ produce the sequence
    vector(100,n,a(n)) \\ N. J. A. Sloane, May 26 2014
    
  • PARI
    v=vector(100, k, k==1); for(n=2, #v, v+=dirmul(v, vector(#v, k, (k>1) && n^valuation(k,n)==k)) ); v \\ Max Alekseyev, Jul 16 2014
    
  • Python
    from sympy import divisors, isprime
    def T(n, m):
        if isprime(n): return 1 if n<=m else 0
        A=filter(lambda d: d<=m, divisors(n)[1:-1])
        s=sum(T(n//d, d) for d in A)
        return s + 1 if n<=m else s
    def a(n): return T(n, n)
    print([a(n) for n in range(1, 106)]) # Indranil Ghosh, Aug 19 2017
    

Formula

The asymptotic behavior of this sequence was studied by Canfield, Erdős & Pomerance and Luca, Mukhopadhyay, & Srinivas. - Jonathan Vos Post, Jul 07 2008
Dirichlet g.f.: Product_{k>=2} 1/(1 - 1/k^s).
If n = p^k for a prime p, a(n) = partitions(k) = A000041(k).
Since the sequence a(n) is the right diagonal of A066032, the given recursive formula for A066032 applies (see Maple program). - Reinhard Zumkeller and Ulrich Schimke (ulrschimke(AT)aol.com)
a(A002110(n)) = A000110(n).
a(p^k*q^k) = A002774(k) if p and q are distinct primes. - R. J. Mathar, Jun 06 2024
a(n) = A028422(n) + 1. - Gus Wiseman, Feb 07 2025

Extensions

Incorrect assertion about asymptotic behavior deleted by N. J. A. Sloane, Jun 08 2009

A025475 1 and the prime powers p^m where m >= 2, thus excluding the primes.

Original entry on oeis.org

1, 4, 8, 9, 16, 25, 27, 32, 49, 64, 81, 121, 125, 128, 169, 243, 256, 289, 343, 361, 512, 529, 625, 729, 841, 961, 1024, 1331, 1369, 1681, 1849, 2048, 2187, 2197, 2209, 2401, 2809, 3125, 3481, 3721, 4096, 4489, 4913, 5041, 5329, 6241, 6561, 6859, 6889, 7921, 8192
Offset: 1

Views

Author

Keywords

Comments

Also nonprime n such that sigma(n)*phi(n) > (n-1)^2. - Benoit Cloitre, Apr 12 2002
If p is a term of the sequence, then the index n for which a(n) = p is given by n := b(p) := 1 + Sum_{k>=2} PrimePi(p^(1/k)). Here, the sum has floor(log_2(p)) positive terms. For any m > 0, the greatest number n such that a(n) <= m is also given by b(m), thus, b(m) is the number of such prime powers <= m. - Hieronymus Fischer, May 31 2013
That 8 and 9 are the only two consecutive integers in this sequence is known as Catalan's Conjecture and was proved in 2002 by Preda Mihăilescu. - Geoffrey Critzer, Nov 15 2015

Crossrefs

Subsequence of A000961. - Reinhard Zumkeller, Jun 22 2011
Differences give A053707.
Cf. A076048 (number of terms < 10^n).
There are four different sequences which may legitimately be called "prime powers": A000961 (p^k, k >= 0), A246655 (p^k, k >= 1), A246547 (p^k, k >= 2), A025475 (p^k, k=0 and k >= 2). When you refer to "prime powers", be sure to specify which of these you mean. Also A001597 is the sequence of nontrivial powers n^k, n >= 1, k >= 2. - N. J. A. Sloane, Mar 24 2018

Programs

  • Haskell
    a025475 n = a025475_list !! (n-1)
    a025475_list = filter ((== 0) . a010051) a000961_list
    -- Reinhard Zumkeller, Jun 22 2011
    
  • Maple
    isA025475 := proc(n)
        if n < 1 then
            false;
        elif n = 1 then
            true;
        elif isprime(n) then
            false;
        elif nops(numtheory[factorset](n)) = 1 then
            true;
        else
            false;
        end if;
    end proc:
    A025475 := proc(n)
        option remember;
        local a;
        if n = 1 then
            1;
        else
            for a from procname(n-1)+1 do
                if isA025475(a) then
                    return a;
                end if;
            end do:
        end if;
    end proc:
    # R. J. Mathar, Jun 06 2013
    # alternative:
    N:= 10^5: # to get all terms <= N
    Primes:= select(isprime, [2,(2*i+1 $ i = 1 .. floor((sqrt(N)-1)/2))]):
    sort([1,seq(seq(p^i, i=2..floor(log[p](N))),p=Primes)]); # Robert Israel, Jul 27 2015
  • Mathematica
    A025475 = Select[ Range[ 2, 10000 ], ! PrimeQ[ # ] && Mod[ #, # - EulerPhi[ # ] ] == 0 & ]
    A025475 = Sort[ Flatten[ Table[ Prime[n]^i, {n, 1, PrimePi[ Sqrt[10^4]]}, {i, 2, Log[ Prime[n], 10^4]}]]]
    {1}~Join~Select[Range[10^4], And[! PrimeQ@ #, PrimePowerQ@ #] &] (* Michael De Vlieger, Jul 04 2016 *)
    Join[{1},Select[Range[100000],PrimePowerQ[#]&&!PrimeQ[#]&]] (* Harvey P. Dale, Oct 29 2023 *)
  • PARI
    for(n=1,10000,if(sigma(n)*eulerphi(n)*(1-isprime(n))>(n-1)^2,print1(n,",")))
    
  • PARI
    is_A025475(n)={ ispower(n,,&p) && isprime(p) || n==1 }  \\ M. F. Hasler, Sep 25 2011
    
  • PARI
    list(lim)=my(v=List([1]),L=log(lim+.5));forprime(p=2,(lim+.5)^(1/3),for(e=3,L\log(p),listput(v,p^e))); vecsort(concat(Vec(v), apply(n->n^2,primes(primepi(sqrtint(lim\1)))))) \\ Charles R Greathouse IV, Nov 12 2012
    
  • PARI
    list(lim)=my(v=List([1])); for(m=2,logint(lim\=1,2), forprime(p=2,sqrtnint(lim,m), listput(v, p^m))); Set(v) \\ Charles R Greathouse IV, Aug 26 2015
    
  • Python
    from sympy import primerange
    A025475_list, m = [1], 10*2
    m2 = m**2
    for p in primerange(1,m):
        a = p**2
        while a < m2:
            A025475_list.append(a)
            a *= p
    A025475_list = sorted(A025475_list) # Chai Wah Wu, Sep 08 2014
    
  • Python
    from sympy import primepi, integer_nthroot
    def A025475(n):
        if n==1: return 1
        def f(x): return int(n-2+x-sum(primepi(integer_nthroot(x,k)[0]) for k in range(2,x.bit_length())))
        kmin, kmax = 1,2
        while f(kmax) >= kmax:
            kmax <<= 1
        while True:
            kmid = kmax+kmin>>1
            if f(kmid) < kmid:
                kmax = kmid
            else:
                kmin = kmid
            if kmax-kmin <= 1:
                break
        return kmax # Chai Wah Wu, Aug 13 2024

Formula

The number of terms <= N is O(sqrt(N)*log N). [See Weisstein link] - N. J. A. Sloane, May 27 2022
A005171(a(n))*A010055(a(n)) = 1. - Reinhard Zumkeller, Nov 01 2009
A192280(a(n)) = 0 for n > 1. - Reinhard Zumkeller, Aug 26 2011
A014963(a(n)) - A089026(a(n)) = A014963(a(n)) - 1. - Eric Desbiaux, May 18 2013
From Hieronymus Fischer, May 31 2013: (Start)
The greatest number n such that a(n) <= m is given by 1 + Sum_{k>=2} A000720(floor(m^(1/k))).
Example 1: m = 10^10 ==> n = 10085;
Example 2: m = 10^11 ==> n = 28157;
Example 3: m = 10^12 ==> n = 80071;
Example 4: m = 10^15 ==> n = 1962690. (End)
Sum_{n>=2} 1/a(n) = Sum_{p prime} 1/(p*(p-1)) = A136141. - Amiram Eldar, Oct 11 2020
From Amiram Eldar, Jan 28 2021: (Start)
Product_{n>=2} (1 + 1/a(n)) = Product_{k>=2} zeta(k)/zeta(2*k) = 2.0729553047...
Product_{n>=2} (1 - 1/a(n)) = A068982. (End)

Extensions

Edited by Daniel Forgues, Aug 18 2009

A000469 1 together with products of 2 or more distinct primes.

Original entry on oeis.org

1, 6, 10, 14, 15, 21, 22, 26, 30, 33, 34, 35, 38, 39, 42, 46, 51, 55, 57, 58, 62, 65, 66, 69, 70, 74, 77, 78, 82, 85, 86, 87, 91, 93, 94, 95, 102, 105, 106, 110, 111, 114, 115, 118, 119, 122, 123, 129, 130, 133, 134, 138, 141, 142, 143, 145, 146, 154, 155, 158
Offset: 1

Views

Author

Dan Bentley (dtb(AT)research.att.com)

Keywords

Comments

Nonprime squarefree numbers.
Except for 1, composite n such that the squarefree part of n is greater than phi(n). - Benoit Cloitre, Apr 06 2002

Crossrefs

Cf. A005117, A007913, A000010, A010051, A239508, A239509, A120944 (composite squarefree numbers, same sequence apart from the first term).

Programs

  • Haskell
    a000469 n = a000469_list !! (n-1)
    a000469_list = filter ((== 0) . a010051) a005117_list
    -- Reinhard Zumkeller, Mar 21 2014
    
  • Maple
    select(numtheory:-issqrfree and not isprime, [$1..1000]); # Robert Israel, Aug 06 2015
  • Mathematica
    lst={}; Do[If[SquareFreeQ[n], If[ !PrimeQ[n], AppendTo[lst,n]]], {n,200}]; lst (* Vladimir Joseph Stephan Orlovsky, Jan 20 2009 *)
    With[{upto=200},Complement[Select[Range[upto],SquareFreeQ],Prime[ Range[ PrimePi[ upto]]]]] (* Harvey P. Dale, Oct 01 2011 *)
    Select[Range[200], !PrimeQ[#] && PrimeOmega[#] == PrimeNu[#] &] (* Carlos Eduardo Olivieri, Aug 06 2015 *)
  • PARI
    for(n=0,64, if(isprime(n), n+1, if(issquarefree(n),print(n))))
    
  • PARI
    for(n=1,160,if(core(n)*(1-isprime(n))>eulerphi(n),print1(n,",")))
    
  • Python
    from math import isqrt
    from sympy import primepi, mobius
    def A000469(n):
        def f(x): return n+primepi(x)+x-sum(mobius(k)*(x//k**2) for k in range(1, isqrt(x)+1))
        m, k = n, f(n)
        while m != k:
            m, k = k, f(k)
        return m # Chai Wah Wu, Aug 02 2024

Formula

n such that A007913(n)>A000010(n). - Benoit Cloitre, Apr 06 2002
N-floor(N/p1) - floor(N/(p2) - ... - floor(N/p(i) + floor(N/(c2) + floor(N/(c3)+ ... + floor(N/c(j)-1 where N is any number; p1,p2 are the primes with p(i) being the first prime > square root of N and c2, c3 are the numbers other than 1 in this sequence with c(j) <= N will yield the number of primes less than or equal to N other than p1, p2, ..., p(i). - Ben Paul Thurston, Aug 15 2007
A005171(a(n))*A008966(a(n)) = 1. - Reinhard Zumkeller, Nov 01 2009
Sum(n=1, Infinity, 1/a(n)^s) = Zeta(s)/Zeta(2s) - PrimeZeta(s). - Enrique Pérez Herrero, Mar 31 2012
n such that A001221(n) = A001222(n), n nonprime. - Carlos Eduardo Olivieri, Aug 06 2015
a(n) = kn + O(n/log n) where k = Pi^2/6. - Charles R Greathouse IV, Aug 02 2024

A066247 Characteristic function of composite numbers: 1 if n is composite else 0.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Dec 09 2001

Keywords

Comments

a(n) = signum(A066246(n)), where signum = A057427. For n > 1: a(n) = 1 - A010051(n) = A005171(n).
a(n) = A057427(A086971(n)). - Reinhard Zumkeller, Dec 14 2012

Crossrefs

Cf. A065855 (partial sums).

Programs

Formula

For n>1 a(n) = 1-floor(1/A001222(n)). - Enrique Pérez Herrero, Aug 08 2012
a(n) = A065855(n)-A065855(n-1) = 1-A000720(n)+A000720(n-1). - Chayim Lowen, Jul 23 2015
Dirichlet g.f.: Sum_{n>=1} a(n)/n^s = Zeta(s)-1-P(s), where P is prime zeta. - Enrique Pérez Herrero, Aug 08 2012
a(n) = 1 if A001222(n) > 1, 0 otherwise. - Antti Karttunen, Nov 20 2017

A062610 Number of ways of writing n = c1 + c2 with c1 and c2 nonprimes [=1 or composite].

Original entry on oeis.org

0, 1, 0, 0, 1, 0, 1, 1, 1, 2, 1, 2, 2, 2, 2, 4, 2, 4, 3, 4, 3, 5, 3, 6, 4, 6, 4, 7, 5, 8, 6, 7, 6, 9, 6, 11, 7, 8, 8, 11, 8, 12, 9, 11, 9, 12, 9, 14, 10, 14, 10, 14, 11, 16, 12, 15, 12, 16, 13, 19, 14, 15, 14, 19, 14, 21, 15, 17, 16, 21, 16, 22, 17, 20, 17, 22, 17, 25, 18, 22, 19, 23, 19
Offset: 1

Views

Author

Labos Elemer, Jul 04 2001

Keywords

Examples

			n = 22 has floor(n/2) = 11 partitions of form n = a+b; 3 partitions are of prime+prime [3+19 = 5+17 = 11+11], 3 partitions are of prime+nonprime [2+20 = 7+15 = 13+9], 5 partitions are of nonprime+nonprime [1+21 = 4+18 = 6+16 = 8+14 = 10+12]. So a(22) = 5.
		

Crossrefs

Programs

  • Mathematica
    Table[Count[Transpose@ {#, n - #} &@ Range[Floor[n/2]], w_ /; Times @@ Boole@ Map[! PrimeQ@ # &, w] == 1], {n, 83}] (* Michael De Vlieger, Jul 04 2016 *)

Formula

a(n) = Sum_{i=1..floor(n/2)} (1 - A010051(i)) * (1 - A010051(n-i)) = Sum_{i=1..floor(n/2)} A005171(i)*A005171(n-i). - Wesley Ivan Hurt, Apr 08 2018
a(n) + A061358(n) + A062602(n) = A004526(n). - R. J. Mathar, Sep 10 2021

A047160 For n >= 2, a(n) = smallest number m >= 0 such that n-m and n+m are both primes, or -1 if no such m exists.

Original entry on oeis.org

0, 0, 1, 0, 1, 0, 3, 2, 3, 0, 1, 0, 3, 2, 3, 0, 1, 0, 3, 2, 9, 0, 5, 6, 3, 4, 9, 0, 1, 0, 9, 4, 3, 6, 5, 0, 9, 2, 3, 0, 1, 0, 3, 2, 15, 0, 5, 12, 3, 8, 9, 0, 7, 12, 3, 4, 15, 0, 1, 0, 9, 4, 3, 6, 5, 0, 15, 2, 3, 0, 1, 0, 15, 4, 3, 6, 5, 0, 9, 2, 15, 0, 5, 12, 3, 14, 9, 0, 7, 12, 9, 4, 15, 6, 7, 0, 9, 2, 3
Offset: 2

Views

Author

Keywords

Comments

I have confirmed there are no -1 entries through integers to 4.29*10^9 using PARI. - Bill McEachen, Jul 07 2008
From Daniel Forgues, Jul 02 2009: (Start)
Goldbach's Conjecture: for all n >= 2, there are primes (distinct or not) p and q s.t. p+q = 2n. The primes p and q must be equidistant (distance m >= 0) from n: p = n-m and q = n+m, hence p+q = (n-m)+(n+m) = 2n.
Equivalent to Goldbach's Conjecture: for all n >= 2, there are primes p and q equidistant (distance >= 0) from n, where p and q are n when n is prime.
If this conjecture is true, then a(n) will never be set to -1.
Twin Primes Conjecture: there is an infinity of twin primes.
If this conjecture is true, then a(n) will be 1 infinitely often (for which each twin primes pair is (n-1, n+1)).
Since there is an infinity of primes, a(n) = 0 infinitely often (for which n is prime).
(End)
If n is composite, then n and a(n) are coprime, because otherwise n + a(n) would be composite. - Jason Kimberley, Sep 03 2011
From Jianglin Luo, Sep 22 2023: (Start)
a(n) < primepi(n)+sigma(n,0);
a(n) < primepi(primepi(n)+n);
a(n) < primepi(n), for n>344;
a(n) = o(primepi(n)), as n->+oo. (End)
If -1 < a(n) < n-3, then a(n) is divisible by 3 if and only if n is not divisible by 3, and odd if and only if n is even. - Robert Israel, Oct 05 2023

Examples

			16-3=13 and 16+3=19 are primes, so a(16)=3.
		

Crossrefs

Programs

  • Haskell
    a047160 n = if null ms then -1 else head ms
                where ms = [m | m <- [0 .. n - 1],
                                a010051' (n - m) == 1, a010051' (n + m) == 1]
    -- Reinhard Zumkeller, Aug 10 2014
    
  • Magma
    A047160:=func;[A047160(n):n in[2..100]]; // Jason Kimberley, Sep 02 2011
    
  • Mathematica
    Table[k = 0; While[k < n && (! PrimeQ[n - k] || ! PrimeQ[n + k]), k++]; If[k == n, -1, k], {n, 2, 100}]
    smm[n_]:=Module[{m=0},While[AnyTrue[n+{m,-m},CompositeQ],m++];m]; Array[smm,100,2] (* Harvey P. Dale, Nov 16 2024 *)
  • PARI
    a(n)=forprime(p=n,2*n, if(isprime(2*n-p), return(p-n))); -1 \\ Charles R Greathouse IV, Jun 23 2017
  • UBASIC
    10 N=2// 20 M=0// 30 if and{prmdiv(N-M)=N-M,prmdiv(N+M)=N+M} then print M;:goto 50// 40 inc M:goto 30// 50 inc N: if N>130 then stop// 60 goto 20
    

Formula

a(n) = n - A112823(n).
a(n) = A082467(n) * A005171(n), for n > 3. - Jason Kimberley, Jun 25 2012

Extensions

More terms from Patrick De Geest, May 15 1999
Deleted a comment. - T. D. Noe, Jan 22 2009
Comment corrected and definition edited by Daniel Forgues, Jul 08 2009

A066246 a(n) = 0 unless n is a composite number A002808(k) then a(n) = k.

Original entry on oeis.org

0, 0, 0, 1, 0, 2, 0, 3, 4, 5, 0, 6, 0, 7, 8, 9, 0, 10, 0, 11, 12, 13, 0, 14, 15, 16, 17, 18, 0, 19, 0, 20, 21, 22, 23, 24, 0, 25, 26, 27, 0, 28, 0, 29, 30, 31, 0, 32, 33, 34, 35, 36, 0, 37, 38, 39, 40, 41, 0, 42, 0, 43, 44, 45, 46, 47, 0, 48, 49, 50, 0, 51, 0, 52, 53, 54, 55, 56, 0, 57
Offset: 1

Views

Author

Reinhard Zumkeller, Dec 09 2001

Keywords

Crossrefs

Programs

  • Haskell
    import Data.List (unfoldr, genericIndex)
    a066246 n = genericIndex a066246_list (n - 1)
    a066246_list = unfoldr x (1, 1, a002808_list) where
       x (i, z, cs'@(c:cs)) | i == c = Just (z, (i + 1, z + 1, cs))
                            | i /= c = Just (0, (i + 1, z, cs'))
    -- Reinhard Zumkeller, Jan 29 2014
  • Mathematica
    Module[{k=1},Table[If[CompositeQ[n],k;k++,0],{n,100}]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jan 03 2019 *)
  • PARI
    a(n)=if(isprime(n),0,max(0,n-primepi(n)-1)) \\ Charles R Greathouse IV, Aug 21 2011
    

Formula

a(n) = A239968(n) + A010051(n) - 1. - Reinhard Zumkeller, Mar 30 2014
a(n) = A065855(n)*A005171(n). - Ridouane Oudra, Jul 29 2025
Showing 1-10 of 86 results. Next