login
Arithmetic mean of next a(n) successive positive integers is prime.
2

%I #16 Jan 17 2017 22:28:01

%S 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,

%T 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,

%U 7,17,7,9,11,13,27,5,7,5,11,9,3,9,7,5,3,1,23,1

%N Arithmetic mean of next a(n) successive positive integers is prime.

%C Corresponding primes: A062044(n).

%C All terms are odd. - _Robert Israel_, Jan 17 2017

%H Robert Israel, <a href="/A214362/b214362.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = 2*(A062042(n)-A062042(n-1))+(-1)^n for n >= 2. - _Robert Israel_, Jan 17 2017

%e (1+2+3)/3 = 2 is prime, so a(1)=3,

%e then (4+5+6)/3 = 5 is prime, so a(2)=3,

%e then 7/1 = 7 is prime, so a(3)=1,

%e then (8+9+10+11+12+13+14)/7 = 11 is prime, so a(4)=7.

%p t:= 1:

%p for n from 1 to 100 do

%p for s from 1 by 2 do

%p if isprime((2*t + s - 1)/2) then

%p A[n]:= s; t:= t+s; break

%p fi

%p od od:

%p seq(A[n],n=1..100); # _Robert Israel_, Jan 17 2017

%o (PARI) firstTerms(n)={

%o my(k=1,j=1,x,y,a=vector(n));

%o while(j<=n,x=0;while(!isprime(k+x),x++);y=2*x+1;k+=y;a[j]=y;j++);

%o return(a)} \\ _R. J. Cano_, Jan 17 2017

%Y Cf. A000040, A062042, A062044, A213815.

%K nonn,easy

%O 1,1

%A _Alex Ratushnyak_, Jul 18 2012