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

A381330 Numbers that are the sum of a prime and the square of a prime in more than one way.

Original entry on oeis.org

11, 27, 28, 32, 38, 51, 52, 54, 56, 62, 66, 68, 72, 78, 80, 86, 92, 96, 98, 108, 110, 116, 122, 126, 128, 132, 134, 138, 140, 146, 150, 152, 156, 158, 162, 164, 171, 172, 174, 176, 180, 182, 186, 188, 192, 198, 200, 204, 206, 210, 212, 216, 218, 222, 224, 228
Offset: 1

Views

Author

Chai Wah Wu, Feb 20 2025

Keywords

Comments

Subsequence of A081053. Most terms are even. The odd terms are 11, 27, 51, 171, 363, 843, 1371, 1851 and must be of the form 2+p^2=4+q for primes p, q. In particular, the odd terms are exactly A049002(n)+4 for n>1.

Examples

			11 is a term since 11 = 2^2+7  = 3^2+2.
27 is a term since 27 = 2^2+23 = 5^2+2.
28 is a term since 28 = 3^2+19 = 5^2+3.
32 is a term since 32 = 3^2+23 = 5^2+7.
		

Crossrefs

Programs

  • PARI
    isok(k) = my(nb=0); forprime(p=2, sqrtint(k), if (isprime(k-p^2), nb++);); nb > 1; \\ Michel Marcus, Feb 21 2025
  • Python
    from math import isqrt
    from itertools import count, islice
    from sympy import isprime, primerange
    def A381330_gen(startvalue=1): # generator of terms >= startvalue
        for n in count(max(startvalue,1)):
            c = 0
            for p in primerange(isqrt(n)+1):
                if isprime(n-p**2):
                    c += 1
                if c>1:
                    yield n
                    break
    A381330_list = list(islice(A381330_gen(),30))
    

A381333 Smallest integer that is the sum of a prime and the square of a prime in n or more ways.

Original entry on oeis.org

6, 11, 56, 176, 188, 362, 398, 668, 1448, 1448, 1592, 2390, 3372, 3632, 4532, 6342, 6342, 6368, 6368, 10632, 12920, 12920, 12942, 19502, 23168, 25038, 25038, 25038, 25472, 32238, 32238, 39800, 39800, 39800, 53360, 64998, 72740, 72740, 72740, 81542, 82880, 82880
Offset: 1

Views

Author

Chai Wah Wu, Feb 20 2025

Keywords

Comments

Subsequence of A081053. All terms are even except for a(2) = 11.

Examples

			a(1) = 6 as 6 = 2 + 2^2.
a(2) = 11 as 11 = 7 + 2^2 = 2 + 3^2.
a(3) = 56 as 56 = 47 + 3^2 = 31 + 5^2 = 7 + 7^2.
a(4) = 176 as 176 = 167 + 3^2 = 151 + 5^2 = 127 + 7^2 = 7 + 13^2.
a(5) = 188 as 188 = 179 + 3^2 = 163 + 5^2 = 139 + 7^2 = 67 + 11^2 = 19 + 13^2.
a(6) = 362 as 362 = 353 + 3^2 = 337 + 5^2 = 313 + 7^2 = 241 + 11^2 = 193 + 13^2 = 73 + 17^2.
		

Crossrefs

Programs

  • PARI
    f(k) = my(nb=0); forprime(p=2, sqrtint(k), if (isprime(k-p^2), nb++);); nb;
    a(n) = my(k=1); while (f(k) < n, k++); k; \\ Michel Marcus, Feb 21 2025
  • Python
    from itertools import count
    from math import isqrt
    from sympy import isprime, primerange
    def A381333(n):
        for m in count(1):
            c = 0
            for p in primerange(isqrt(m)+1):
                if isprime(m-p**2):
                    c += 1
                if c>=n:
                    return m
    

A080713 Numbers not of the form p + q^2.

Original entry on oeis.org

1, 2, 3, 4, 5, 8, 10, 13, 18, 19, 24, 25, 29, 31, 34, 37, 39, 43, 49, 53, 55, 58, 59, 61, 64, 67, 69, 73, 74, 79, 81, 85, 89, 91, 94, 95, 97, 99, 100, 103, 109, 115, 119, 121, 125, 127, 129, 130, 133, 137, 139, 142, 145, 147, 149, 151, 154, 157, 159, 163, 165, 169, 170
Offset: 1

Views

Author

Robert G. Wilson v, Mar 05 2003

Keywords

Crossrefs

Complement of A081053.

Programs

  • Mathematica
    Complement[ Table[k, {k, 1, 200}], Take[ Union[ Flatten[ Table[ Prime[i] + Prime[j]^2, {i, 1, 80}, {j, 1, 10}]]], 250]]
  • PARI
    is(n)=if(n%2, !isprime(n-4) && isprimepower(n-2)!=2, forprime(q=3, sqrtint(n), if(isprime(n-q^2), return(0))); n!=6) \\ Charles R Greathouse IV, Oct 25 2017

A381334 Smallest integer that is the sum of a prime and the square of a prime in exactly n ways.

Original entry on oeis.org

6, 11, 56, 176, 188, 362, 398, 668, 1568, 1448, 1592, 2390, 3372, 3632, 4532, 6888, 6342, 8582, 6368, 10632, 13002, 12920, 12942, 19502, 23168, 26990, 26292, 25038, 25472, 33648, 32238, 41048, 40640, 39800, 53360, 64998, 77348, 74718, 72740, 81542, 89682, 82880
Offset: 1

Views

Author

Chai Wah Wu, Feb 20 2025

Keywords

Comments

Subsequence of A081053. All terms are even except for a(2) = 11.
a(n) >= A381333(n).

Examples

			a(1) = 6 as 6 = 2 + 2^2.
a(2) = 11 as 11 = 7 + 2^2 = 2 + 3^2.
a(3) = 56 as 56 = 47 + 3^2 = 31 + 5^2 = 7 + 7^2.
a(4) = 176 as 176 = 167 + 3^2 = 151 + 5^2 = 127 + 7^2 = 7 + 13^2.
a(5) = 188 as 188 = 179 + 3^2 = 163 + 5^2 = 139 + 7^2 = 67 + 11^2 = 19 + 13^2.
a(6) = 362 as 362 = 353 + 3^2 = 337 + 5^2 = 313 + 7^2 = 241 + 11^2 = 193 + 13^2 = 73 + 17^2.
a(9) = 1568 as 1568 = 1559 + 3^2 = 1543 + 5^2 = 1447 + 11^2 = 1399 + 13^2 = 1279 + 17^2 = 1039 + 23^2 = 727 + 29^2 = 607 + 31^2 = 199 + 37^2.
Note that a(9) > A381333(9) = 1448 as 1448 has 10 decompositions: 1448 = 1439 + 3^2 = 1423 + 5^2 = 1399 + 7^2 = 1327 + 11^2 = 1279 + 13^2 = 1087 + 19^2 = 919 + 23^2 = 607 + 29^2 = 487 + 31^2 = 79 + 37^2.
		

Crossrefs

Programs

  • Maple
    N:= 10^6: # for a(1)..a(k) where a(k+1) is the first term > N
    P:= select(isprime,[2,seq(i,i=3..N,2)]):
    W:= Vector(1..N/2,datatype=integer[4]):
    for i from 2 while P[i]^2 < N do
    m:= ListTools:-BinaryPlace(P, N - P[i]^2);
    J:= (P[2..m] +~ P[i]^2)/~ 2;
      W[J]:= W[J] +~ 1;
    od:
    imax:= max[index](W):
    R:= Vector(W[imax]):
    R[1]:= 6: R[2]:= 11:
    for i from 1 to imax do
    r:= W[i];
    if r > 0 and R[r] = 0 then R[r]:= 2*i fi;
    od:
    if member(0,R,'i') then convert(R[1..i-1],list) else convert(R,list) fi; # Robert Israel, Feb 24 2025
  • Python
    from itertools import count
    from math import isqrt
    from sympy import isprime, primerange
    def A381334(n): return next(filter(lambda m:sum(1 for p in primerange(isqrt(m)+1) if isprime(m-p**2))==n,count(1)))

A080693 Numbers of the form p^2*q + r*s where p,q,r,s are (not necessarily distinct) primes.

Original entry on oeis.org

12, 14, 16, 17, 18, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86
Offset: 1

Views

Author

Mario Maqueda Garcia [Garci'a] (israelmira(AT)terra.es), Mar 03 2003

Keywords

Comments

A conjecture of Goldbach type says every number >= 26 is of this form.

Examples

			12=2^2*2 + 2*2
		

Crossrefs

Cf. A081053.

Programs

  • Maple
    H := proc(n::posint) local p,q,r,s; p := 2; while p<=floor(sqrt((n-4)/2)) do q := 2; while q<=floor((n-4)/p^2) do s := 2; while s<=floor((n-p^2*q)/2) do r := (n-p^2*q)/s; if type(r,posint) then if isprime(r) then return(true,p,q,s,r); end if; end if; s := nextprime(s); end do; q := nextprime(q); end do; p := nextprime(p); end do; return(false); end:
  • Mathematica
    Take[ Union[ Flatten[ Table[ Prime[p]^2*Prime[q] + Prime[r]*Prime[s], {p, 1, 6}, {q, 1, 15}, {r, 1, 15}, {s, 1, 15}]]], 70]

Extensions

Edited and extended by Robert G. Wilson v, Mar 05 2003
Showing 1-5 of 5 results.