%I #24 Sep 20 2023 15:58:08
%S 41,83,197,199,223,240,251,281,287,340,371,401,439,491,510,593,660,
%T 733,803,857,864,883,931,941,961,983,990,991,1012,1060,1061,1099,1104,
%U 1187,1236,1283,1313,1361,1381,1392,1433,1439,1493,1511,1523,1524,1553
%N Integers that can be expressed as the sum of consecutive primes in exactly 3 ways.
%D R. K. Guy, Unsolved Problems in Number Theory, section C2.
%H Robert Israel, <a href="/A054998/b054998.txt">Table of n, a(n) for n = 1..10000</a>
%H Carlos Rivera, <a href="http://www.primepuzzles.net/puzzles/puzz_046.htm">Puzzle 46. Primes expressible as sum of consecutive primes in K ways</a>, The Prime Puzzles and Problems Connection.
%F A054845(a(n)) = 3. - _Ray Chandler_, Sep 20 2023
%e 41 can be expressed as 41 or 11+13+17 or 2+3+5+7+11+13, so 41 is in the sequence.
%p N:= 10^4: # to get all terms <= N
%p P:= [0,op(select(isprime, [2,seq(i,i=3..N,2)]))]:
%p nP:= nops(P);
%p S:= ListTools:-PartialSums(P):
%p V:= Vector(N):
%p for i from 1 to nP-1 do
%p for j from i+1 to nP while S[j] - S[i] <= N do
%p V[S[j]-S[i]]:= V[S[j]-S[i]]+1
%p od od:
%p select(t -> V[t] = 3, [$1..N]): # _Robert Israel_, Apr 05 2017
%t Module[{nn = 300, s}, s = Array[Prime, nn]; Keys@ Take[Select[KeySort@ Merge[Table[PositionIndex@ Map[Total, Partition[s, k, 1]], {k, nn/2}], Identity], Length@ # == 3 &], Floor[nn/6]]] (* _Michael De Vlieger_, Apr 06 2017, Version 10 *)
%Y Cf. A054845, A054859, A054996, A054997, A054999, A055500, A055001.
%K nonn
%O 1,1
%A _Jud McCranie_, May 30 2000