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

A358156 a(n) is the smallest number k such that the sum of k consecutive prime numbers starting with the n-th prime is a square.

Original entry on oeis.org

9, 23, 4, 1862, 14, 3, 2, 211, 331, 163, 366, 3, 124, 48, 2, 449, 8403, 121, 35, 2, 4, 105, 77, 43, 190769, 1726, 234, 248, 200, 295, 293, 73, 4, 873, 32, 64, 2456139382, 8, 4519, 14, 123, 5, 9395, 296, 26, 5, 3479, 810, 9, 7091, 1669, 157, 1189, 12559, 269, 4930, 21, 376, 3
Offset: 1

Views

Author

Todor Szimeonov, Nov 01 2022

Keywords

Comments

a(60) > 10^10 and a(68) > 10^13. - Martin Ehrenstein, Nov 09 2022

Examples

			For n=7, prime(7) = 17 and starting there 2 primes 17 + 19 = 36 which is square, so that a(7)=2.
		

Crossrefs

Cf. A000040, A000290, A105720, A230327 (exchanges the roles of n, k), A287027 (squares reached).
Indices of terms: A064397 (2's), A076305 (3's), A072849 (4's), A166255 (70's), A166261 (120's).

Programs

  • Maple
    f:= proc(n) local p,s,k;
      p:= ithprime(n); s:= p;
      for k from 2 do
        p:= nextprime(p);
        s:= s+p;
        if issqr(s) then return k fi
      od
    end proc:
    map(f, [$1..36]); # Robert Israel, Nov 08 2022
  • Mathematica
    a[n_] := Module[{p = s = Prime[n], k = 1}, While[! IntegerQ[Sqrt[s]], p = NextPrime[p]; s += p; k++]; k]; Array[a, 36] (* Amiram Eldar, Nov 08 2022 *)

Extensions

a(25)-a(36) from Robert Israel, Nov 08 2022
a(37)-a(59) from Martin Ehrenstein, Nov 09 2022

A357813 a(n) is the least number k such that the sum of n^2 consecutive primes starting at prime(k) is a square.

Original entry on oeis.org

3, 1, 78, 333, 84, 499, 36, 1874, 1102, 18, 183, 2706, 23, 104, 739, 1055, 8435, 633, 42130, 13800, 942, 55693, 7449, 13270, 41410, 4317, 17167, 61999, 17117, 9161, 46704, 12447, 2679, 2971, 3946, 103089, 6359, 19601, 7240, 422, 690, 20851, 963, 36597, 3559, 111687, 12926, 4071, 30622, 6355
Offset: 2

Views

Author

Jean-Marc Rebert, Nov 12 2022

Keywords

Examples

			Define sp(k,n) to be the sum of n^2 consecutive primes starting at prime(k).
a(2) = 3 because sp(k,2) at k=3 is 5 + 7 + 11 + 13 = 36 = 6^2, a square, and no smaller k has this property.
a(3) = 1 because sp(k,3) at k=1 is 2 + 3 + 5 + 7 + 11 + 13 + 17 + 19 + 23 = 100 = 10^2, a square, and no smaller k has this property.
a(4) = 78 because sp(k,4) at k=78 is 397 + 401 + ... + 487 = 7056 = 84^2, a square, and no smaller k has this property.
		

Crossrefs

Cf. A358156. Subsequence of A230327.

Programs

  • PARI
    \\ sum of n^2 consecutive primes starting at prime(k).
    sp(k,n)=my(u=primes([prime(k),prime(k+n*n-1)]));return(vecsum(u))
    \\ Least number k such that sp(k,n) is a square.
    a(n)=my(k=1);while(!issquare(sp(k,n)),k++);k
    
  • PARI
    a(n) = { my(pr = primes(n^2), s = vecsum(pr), startprime = nextprime(pr[#pr] + 1), res = 1); pr = List(pr); forprime(p = startprime, oo, if(issquare(s), return(res); ); res++; s += (p - pr[1]); listput(pr, p); listpop(pr, 1); ) } \\ David A. Corneth, Nov 13 2022

Formula

a(n) = A230327(n^2).
Showing 1-2 of 2 results.