%I #8 Feb 28 2017 22:59:29
%S 0,0,0,1,2,2,3,5,7,9,11,11,13,16,17,20,23,24,26,30,32,36,40,44,46,49,
%T 53,56,59,64,69,74,78,83,87,92,95,100,105,111,115,119,126,129,135,142,
%U 148,155,160,164,169,173,179,187,194,201,208,215,218,226,235,243,248,257
%N Number of arithmetic progressions of primes (p,q,r) of length 3 with r <= prime(n).
%e a(4)=1 counts the progression (3,5,7) with all 3 members less than or equal to prime(4)=7.
%e a(5)=2 counts (3,5,7) and (3,7,11). a(7)=3 counts (3,5,7), (3,7,11) and (5,11,17).
%e Progressions with length larger than 3 are defined to contribute with each of their sublists: The progression (5,11,17,23) counts twice in a(9), as (5,11,17) and as (11,17,23).
%p A125505 := proc(n,verb) local r,p,a,q,strid; a := 0 ; p := 2 ; while p+4 <= ithprime(n) do for strid from 2 do q := p+strid ; r := q+strid ; if r > ithprime(n) then break ; fi ; if isprime(q) and isprime(r) then if verb then print(n,p,q,r) ; fi ; a := a+1 ; fi ; od: p := nextprime(p) ; od: RETURN(a) ; end: seq(A125505(n,false),n=1..80) ; # _R. J. Mathar_, Nov 21 2007
%K nonn
%O 1,5
%A _Giovanni Teofilatto_, Jan 03 2007; definition corrected Jan 26 2007
%E Corrected and extended by _R. J. Mathar_, Nov 21 2007