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-8 of 8 results.

A002471 Number of partitions of n into a prime and a square.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

a(A014090(n))=0; a(A014089(n))>0; a(A143989(n))=1. - Reinhard Zumkeller, Sep 07 2008

References

  • Selmer, Ernst S.; Eine numerische Untersuchung ueber die Darstellung der natuerlichen Zahlen als Summe einer Primzahl und einer Quadratzahl. Arch. Math. Naturvid. 47, (1943). no. 2, 21-39.
  • 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).

Crossrefs

Programs

  • Haskell
    a002471 n = sum $ map (a010051 . (n -)) $ takeWhile (< n) a000290_list
    -- Reinhard Zumkeller, Jul 23 2013, Sep 30 2011
    
  • Maple
    n->nops(select(isprime,[ seq(n-i^2,i=0..trunc(sqrt(n))) ])):
    with(combstruct): specM0073 := {N=Prod(P, S),P=Set(Z,card>=1), S=Set(Z,card>=0)}: `combstruct/compile`(specM0073,unlabeled): `combstruct/Count`[ specM0073,unlabeled ][ P ] := proc(p) option remember; if isprime(p) then 1 else 0 fi end: `combstruct/Count`[ specM0073,unlabeled ][ S ] := proc(p) option remember; if type(sqrt(p), integer) then 1 else 0 fi end: M0073 := n->count([ N,specM0073,unlabeled ],size=n):
  • Mathematica
    a[n_] := Count[p /. {ToRules[ Reduce[ p > 1 && q >= 0 && n == p + q^2, {p, q}, Integers]]}, _?PrimeQ]; Table[ a[n], {n, 1, 81}] (* from Jean-François Alcover, Sep 30 2011 *)
  • PARI
    a(n)=if(n>1, sum(k=0,sqrtint(n-2), isprime(n-k^2)), 0) \\ Charles R Greathouse IV, Feb 08 2017

Formula

G.f.: (Sum_{i>=0} x^(i^2))*(Sum_{j>=1} x^prime(j)). - Ilya Gutkovskiy, Feb 07 2017

Extensions

Sequence corrected by Paul Zimmermann, Mar 15 1996

A064283 Least number which may be expressed as the sum of a prime number and a nonzero square in exactly n different ways.

Original entry on oeis.org

3, 6, 27, 38, 83, 167, 248, 227, 488, 398, 887, 668, 902, 908, 1238, 2012, 1448, 1748, 1592, 2537, 2672, 3902, 4457, 4703, 3632, 3713, 5843, 6233, 7052, 8333, 5297, 8888, 9602, 9092, 6368, 9908, 13187, 8153, 12473, 8777, 15923, 16463, 14528, 14852, 20807
Offset: 1

Views

Author

Robert G. Wilson v, Sep 24 2001

Keywords

Comments

A064272(a(n)) = n and A064272(m) <> n for m < a(n). - Reinhard Zumkeller, Mar 31 2013

Crossrefs

Programs

  • Haskell
    import Data.List (elemIndex)
    import Data.Maybe (fromJust)
    a064283 = (+ 2) . fromJust . (`elemIndex` a064272_list)
    -- Reinhard Zumkeller, Mar 31 2013

Extensions

More terms from Vladeta Jovovic, Sep 25 2001
More terms from Sean A. Irvine, Jun 25 2023

A214583 Numbers m such that for all k with gcd(m, k) = 1 and m > k^2, m - k^2 is prime.

Original entry on oeis.org

3, 4, 6, 8, 12, 14, 18, 20, 24, 30, 32, 38, 42, 48, 54, 60, 62, 68, 72, 80, 84, 90, 98, 108, 110, 132, 138, 140, 150, 180, 182, 198, 252, 318, 360, 398, 468, 570, 572, 930, 1722
Offset: 1

Views

Author

Hans Ruegg, Jul 21 2012

Keywords

Comments

No further terms < 10^10.
This sequence is based on a remark in a paper distributed over the Internet (see the Leo Moser link) under the heading "Unsolved Problems and Conjectures" (page 84):
"Is 968 the largest number n such that for all k with (n, k) = 1 and n > k^2, n - k^2 is prime? (Erdős)"
The statement by Moser contains an error: 968 does NOT have this property (968-25*25 = 343 = 7*7*7), and the largest such number (1722) is larger than 968.
A224076(n) <= A064272(a(n)+1). - Reinhard Zumkeller, Mar 31 2013

Examples

			For example, the number 20 is part of this sequence because 20-1*1 = 19 (prime), and 20-3*3 = 11 (prime). Not considered are 20-2*2 and 20-4*4, because 2 and 4 are not relative primes to 20.
		

Crossrefs

Cf. A065428.
Cf. A224075; subsequence of A008864.

Programs

  • Haskell
    a214583 n = a214583_list !! (n-1)
    a214583_list = filter (p 3 1) [2..] where
       p i k2 x = x <= k2 || (gcd k2 x > 1 || a010051' (x - k2) == 1) &&
                             p (i + 2) (k2 + i) x
    -- Reinhard Zumkeller, Mar 31 2013, Jul 22 2012
  • Mathematica
    Reap[For[p = 2, p < 2000, p = NextPrime[p], n = p+1; q = True; k = 1; While[k*k < n, If[GCD[k, n] == 1, If[! PrimeQ[n - k^2], q = False; Break[]]]; k += 1]; If[q, Sow[n]]]] [[2, 1]] (* Jean-François Alcover, Oct 11 2013, after Joerg Arndt's Pari program *)
    gQ[n_]:=AllTrue[n-#^2&/@Select[Range[Floor[Sqrt[n]]],CoprimeQ[ #, n]&], PrimeQ]; Select[Range[2000],gQ] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Dec 02 2018 *)
  • PARI
    N=10^10;
    default(primelimit,N);
    { forprime (p=2, N,
        n = p + 1;
        q = 1;
        k = 1;
        while ( k*k < n,
            if ( gcd(k,n)==1,
                if ( ! isprime(n-k^2),  q=0; break() );
            );
            k += 1;
        );
        if ( q, print1(n,", ") );
    ); }
    /* Joerg Arndt, Jul 21 2012 */
    

A283760 Expansion of (Sum_{i>=1} x^prime(i))*(Sum_{j>=1} x^(j^3)).

Original entry on oeis.org

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

Views

Author

Ilya Gutkovskiy, Mar 16 2017

Keywords

Comments

Number of representations of n as the sum of a prime number and a positive cube.

Examples

			a(32) = 2 because 32 = 31 + 1^3 = 5 + 3^3.
		

Crossrefs

Programs

  • Mathematica
    nmax = 120; Rest[CoefficientList[Series[Sum[x^Prime[i], {i, 1, nmax}] Sum[x^j^3, {j, 1, nmax}], {x, 0, nmax}], x]]
  • PARI
    concat([0,0], Vec((sum(i=1, 120, x^prime(i)) * sum(j=1, 120, x^(j^3))) + O(x^121))) \\ Indranil Ghosh, Mar 16 2017
    
  • Scheme
    (define (A283760 n) (cond ((< n 2) 0) (else (let loop ((k (A048766 n)) (s 0)) (if (< k 1) s (loop (- k 1) (+ s (A010051 (- n (expt k 3)))))))))) ;; Antti Karttunen, Aug 18 2017

Formula

G.f.: (Sum_{i>=1} x^prime(i))*(Sum_{j>=1} x^(j^3)).

A224076 Row lengths of triangle in A224075.

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 3, 3, 2, 2, 3, 2, 4, 4, 3, 3, 2, 2, 4, 3, 4, 3, 4, 4, 3, 4, 5, 4, 4, 6, 5, 10, 6, 6, 10, 8, 11
Offset: 1

Views

Author

Reinhard Zumkeller, Mar 31 2013

Keywords

Crossrefs

Programs

  • Haskell
    a224076 = length . a224075_row

Formula

a(n) <= A064272(A214583(n)+1) for n such that A214583 is defined.

A302354 Expansion of (Sum_{i>=1} x^prime(i))*(Sum_{j>=0} x^(j^3)).

Original entry on oeis.org

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

Views

Author

Ilya Gutkovskiy, Apr 06 2018

Keywords

Comments

Number of representations of n as the sum of a prime number and a nonnegative cube.

Examples

			a(11) = 2 because 11 = 3 + 2^3 = 11 + 0^3.
		

Crossrefs

Programs

  • Mathematica
    nmax = 120; Rest[CoefficientList[Series[Sum[x^Prime[i], {i, 1, nmax}] Sum[x^j^3, {j, 0, nmax}], {x, 0, nmax}], x]]

Formula

G.f.: (Sum_{i>=1} x^prime(i))*(Sum_{j>=0} x^(j^3)).

A365167 Number of representations of n as the sum of a prime number and a fourth power of a positive integer.

Original entry on oeis.org

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

Views

Author

Ilya Gutkovskiy, Aug 24 2023

Keywords

Crossrefs

Programs

  • Mathematica
    nmax = 120; CoefficientList[Series[Sum[x^Prime[i], {i, 1, nmax}] Sum[x^j^4, {j, 1, nmax^(1/4)}], {x, 0, nmax}], x] // Rest

Formula

G.f.: (Sum_{i>=1} x^prime(i)) * (Sum_{j>=1} x^(j^4)).

A253238 Number of ways to write n as a sum of a perfect power (>1) and a prime.

Original entry on oeis.org

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

Views

Author

Eric Chen, May 17 2015

Keywords

Comments

In this sequence, "perfect power" does not include 0 or 1, "prime" does not include 1. Both "perfect power" and "prime" must be positive.
In the past, I conjectured that a(n) > 0 for all n>24, but this is not true. My PARI program found that a(1549) = 0.
I also asked which a(n) are 1. For example, 331 is a de Polignac number (A006285), so it cannot be written as 2^n+p with p prime, and 331-6^n must divisible by 5, 331-10^n must divisible by 3, ..., 331-18^2 = 331-324 = 7 is prime (and it is the only prime of the form 331-m^n, with m, n natural numbers, m>1, n>1), so a(331) = 1. Similarly, a(3319) = 1. Conjecture: a(n) > 1 for all n > 3319.
This conjecture is not true: a(1771561) = 0. (See A119748)
Another conjecture: For every number m>=0, there is a number k such that a(n)>=m for all n>=k.
Another conjecture: Except for k=2, first occurrence of k must be earlier then first occurrence of k+1.
For n such that a(n) = 0, see A119748.
For n such that a(n) = 1, see the following a-file of this sequence.

Crossrefs

Programs

  • Mathematica
    nn = 128; pwrs = Flatten[Table[Range[2, Floor[nn^(1/ex)]]^ex, {ex, 2, Floor[Log[2, nn]]}]]; pp = Prime[Range[PrimePi[nn]]]; t = Table[0, {nn}]; Do[ t[[i[[1]]]] = i[[2]], {i, Tally[Sort[Select[Flatten[Outer[Plus, pwrs, pp]], # <= nn &]]]}]; t
  • PARI
    a(n) = sum(k=1, n-1, ispower(k) && isprime(n-k))
    
  • PARI
    a(n)=sum(e=2,log(n)\log(2),sum(b=2,sqrtnint(n,e),isprime(n-b^e)&&!ispower(b))) \\ Charles R Greathouse IV, May 28 2015
Showing 1-8 of 8 results.