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.

A045985 a(n) = least k such that sum of first k primes is n times a prime.

Original entry on oeis.org

1, 3, 10, 5, 3, 123, 8, 15, 20, 147, 8, 97, 92, 5, 414, 27, 120, 739, 144, 9, 86, 69, 858, 99, 62, 61, 26, 33, 7, 57, 456, 11, 76, 13, 180, 207, 58, 23, 166, 17, 38, 339, 10, 693, 242, 23, 1162, 169, 440, 9, 374, 117, 682, 187, 1284, 683, 70, 281, 48
Offset: 1

Views

Author

Keywords

Examples

			a(3) = 10 because the partial sum of the first 10 primes is 3*43 = 129.
		

Crossrefs

Programs

  • Haskell
    a045985 n = head [k | (k, x) <- zip [1..] a007504_list,
                          let (y, r) = divMod x n, r == 0, a010051' y == 1]
    -- Reinhard Zumkeller, Oct 05 2015
  • Mathematica
    a[n_] := Catch[For[p=0; sp=0; k=1, True, k++, p = NextPrime[p]; sp = sp+p; If[PrimeQ[sp/n], Throw[k]]]]; Table[a[n], {n, 1, 59}] (* Jean-François Alcover, Nov 13 2012 *)
    Module[{nn=1500,p,t},p=Accumulate[Prime[Range[nn]]];t=Thread[{Range[ nn],p}];Table[SelectFirst[t,PrimeQ[ #[[2]]/n]&],{n,60}]][[All,1]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Mar 16 2020 *)

Extensions

More terms from David W. Wilson