A214362 Arithmetic mean of next a(n) successive positive integers is prime.
3, 3, 1, 7, 5, 7, 5, 11, 1, 7, 5, 7, 9, 3, 9, 11, 5, 3, 1, 7, 5, 23, 1, 19, 9, 11, 1, 3, 17, 23, 1, 7, 5, 7, 17, 7, 5, 11, 1, 19, 9, 3, 5, 23, 9, 3, 9, 7, 5, 7, 1, 11, 5, 3, 13, 7, 17, 7, 5, 11, 1, 7, 17, 7, 9, 11, 13, 27, 5, 7, 5, 11, 9, 3, 9, 7, 5, 3, 1, 23, 1
Offset: 1
Examples
(1+2+3)/3 = 2 is prime, so a(1)=3, then (4+5+6)/3 = 5 is prime, so a(2)=3, then 7/1 = 7 is prime, so a(3)=1, then (8+9+10+11+12+13+14)/7 = 11 is prime, so a(4)=7.
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Programs
-
Maple
t:= 1: for n from 1 to 100 do for s from 1 by 2 do if isprime((2*t + s - 1)/2) then A[n]:= s; t:= t+s; break fi od od: seq(A[n],n=1..100); # Robert Israel, Jan 17 2017
-
PARI
firstTerms(n)={ my(k=1,j=1,x,y,a=vector(n)); while(j<=n,x=0;while(!isprime(k+x),x++);y=2*x+1;k+=y;a[j]=y;j++); return(a)} \\ R. J. Cano, Jan 17 2017
Comments