← Complete problem index

PROJECT EULER · #0874

Maximal Prime Score

Statement only · SolvedOriginal problem ↗

Let p(t) denote the (t+1)th prime number. So that p(0)=2, p(1)=3, etc.
We define the prime score of a list of nonnegative integers [a1,,an] as the sum i=1np(ai).
Let M(k,n) be the maximal prime score among all lists [a1,,an] such that:

  • 0ai<k for each i;
  • the sum i=1nai is a multiple of k.

For example, M(2,5)=14 as [0,1,1,1,1] attains a maximal prime score of 14.

Find M(7000,p(7000)).

Write-up coming later

The complete problem is available here. An approach, code, and answer will be added later.