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

A352423 Numbers that are the sum of some number of consecutive prime cubes.

Original entry on oeis.org

8, 27, 35, 125, 152, 160, 343, 468, 495, 503, 1331, 1674, 1799, 1826, 1834, 2197, 3528, 3871, 3996, 4023, 4031, 4913, 6859, 7110, 8441, 8784, 8909, 8936, 8944, 11772, 12167, 13969, 15300, 15643, 15768, 15795, 15803, 19026, 23939, 24389, 26136, 27467, 27810, 27935, 27962, 27970, 29791
Offset: 1

Views

Author

Michel Marcus, Apr 26 2022

Keywords

Crossrefs

Programs

  • PARI
    lista(nn) = {my(list = List(), ip = primepi(nn), vp = primes(ip)); for(i=1, ip, my(s=vp[i]^3); listput(list, s); for (j=i+1, ip, s += vp[j]^3; if (s >vp[ip]^3, break); listput(list, s); ); ); Vec(vecsort(list, , 8)); }
    
  • Python
    import heapq
    from sympy import prime
    from itertools import islice
    def agen(): # generator of terms
        p = prime(1)**3; h = [(p, 1, 1)]; nextcount = 2
        while True:
            (v, s, l) = heapq.heappop(h)
            yield v
            if v >= p:
                p += prime(nextcount)**3
                heapq.heappush(h, (p, 1, nextcount))
                nextcount += 1
            v -= prime(s)**3; s += 1; l += 1; v += prime(l)**3
            heapq.heappush(h, (v, s, l))
    print(list(islice(agen(), 47))) # Michael S. Branicky, Apr 26 2022

A352424 Numbers that can be written as sums of squares of consecutive primes in two ways.

Original entry on oeis.org

14720439, 16535628, 34714710, 40741208, 61436388, 603346308, 1172360113, 1368156941, 1574100889, 1924496102, 1989253499, 2021860243, 6774546339, 9770541610, 12230855963, 12311606487, 12540842446, 14513723777, 26423329489, 38648724198, 47638558043, 50195886916, 50811319931, 56449248367
Offset: 1

Views

Author

Michel Marcus, Apr 26 2022

Keywords

Crossrefs

Programs

  • Python
    # see link for a version suitable for producing b-file
    from sympy import primerange, integer_nthroot
    def aupto(limit):
        adict = dict()
        rootlimit = integer_nthroot(limit, 2)[0]
        for x in primerange(2, rootlimit+1):
            s = x**2
            adict[s] = 1
            for y in primerange(x+1, rootlimit+1):
                s += y**2
                if s <= limit:
                    if s not in adict:
                        adict[s] = 1
                    else:
                        adict[s] += 1
                else:
                    break
        return sorted(s for s in adict if adict[s] == 2)
    print(aupto(6*10**10)) # Michael S. Branicky, Apr 26 2022

A372041 Least prime p such that the sum of squares of the 2n + 1 consecutive primes starting with p is prime, or -1 if no such p exists.

Original entry on oeis.org

3, 3, 5, 3, 3, 5, -1, 5, 5, -1, 3, 7, -1, 3, 13, -1, 5, 5, -1, 7, 23, -1, 13, 5, -1, 7, 5, -1, 59, 29, 3, 3, 5, -1, 3, 5, -1, 13, 11, -1, 37, 23, -1, 43, 11, -1, 3, 5, -1, 11, 5, -1, 5, 19, -1, 5, 43, -1, 13, 29, -1, 7, 19, -1, 41, 47, -1, 13, 11, 3, 7, 5, -1, 29, 7, -1, 79, 13, 3, 3
Offset: 1

Views

Author

Michel Lagneau, Apr 17 2024

Keywords

Comments

a(n) = 2 never occurs, since the sum starting at 2 is always even and >= 4, so not prime.
a(n) = 3 iff n is in A370633 (and equivalently iff 2*n+1 is in A071149).
For n == 1 (mod 3), so 2*n+1 is a multiple of 3, a(n) = 3 or -1, since all primes >= 5 are congruent to 1 (mod 6) so the sum starting at 5 or more is a multiple of 3 and so not prime.

Examples

			a(6) = 5 because 5 is the smallest of 2*6+1 = 13 consecutive primes whose sum of squares = 5^2 + 7^2 + 11^2 + 13^2 + 17^2 + 19^2 + 23^2 + 29^2 + 31^2 + 37^2 + 41^2 + 43^2 + 47^2 = 10453 is prime.
a(7) = -1 because 7 == 1 (mod 3) so its only possibility is that the sum starts at 3, but 3^2 + ... + 53^2 = 13271 is not prime.
		

Crossrefs

Cf. A024450, A089793, A318351, A340771, A370633 (indices of 3's).

Programs

  • PARI
    a(n) = if ((n % 3) == 1, my(vp = primes(2*n+2)); if (isprime(sum(k=2, #vp, vp[k]^2)), return (3), return(-1));); my(vp = primes(2*n+2)); while(! isprime(sum(k=2, #vp, vp[k]^2)), vp = concat(setminus(vp, Set(vp[1])), nextprime(vp[2*n+2]+1))); vp[2]; \\ Michel Marcus, May 16 2024

A376916 Primes that are the sum of some number of consecutive prime squares.

Original entry on oeis.org

13, 83, 373, 653, 1543, 2393, 3271, 4519, 4723, 5381, 6701, 7591, 8069, 8219, 9439, 10453, 11719, 19541, 20269, 20477, 23599, 24821, 24953, 32939, 35323, 38219, 39631, 41539, 45319, 51031, 53549, 55721, 56179, 56383, 56599, 56909, 65419, 69389, 73331, 74441, 75997, 81299, 87589, 89459, 90199, 93581, 96661, 97847, 98017, 107741, 108827, 109849
Offset: 1

Views

Author

Robert Israel, Oct 09 2024

Keywords

Comments

Primes in A340771.

Examples

			a(3) = 373 is a term because 373 is prime and 373 = 3^2 + 5^2 + 7^2 + 11^2 + 13^2 where 3, 5, 6, 11 and 13 are consecutive primes.
		

Crossrefs

Cf. A340771.

Programs

  • Maple
    N:= 2*10^5: # for terms <= N
    PS:= [0, seq(ithprime(i)^2, i=1..numtheory:-pi(floor(sqrt(N))))]:
    SPS:= ListTools:-PartialSums(PS):
    sort(convert(select(t -> t <= N and isprime(t), {seq(seq(SPS[t]-SPS[s], s=1..t-2), t=2..nops(SPS))}), list);
Showing 1-4 of 4 results.