OFFSET
1,1
COMMENTS
a(n) is the smallest prime such that there is no i < j < n with a(n) - a(j) = a(j) - a(i).
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
EXAMPLE
Table showing derivation of first 10 values.
n a(n) comment
1 2
2 3
3 5
4 11 a(4) can't be 7 because (3,5,7) is in arithmetic progression.
5 13
6 29 a(6) can't be 17 because (5,11,17); can't be 19 because (3,11,19); can't be 23 because (3,13,23)
7 31
8 37
9 41
10 67 a(10) not 43 as (31,37,43); not 47 as (11,29,47); not 53 as (29,41,53); not 59 as (13,31,59); not 61 as (13,37,61)
MATHEMATICA
f[l_List] := Block[{c, f = 0}, c = If[l == {}, 0, l[[ -1]]]; While[f == 0, c = NextPrime[c]; If[Intersection[l, l - (c - l)] == {}, f = 1]; ]; Append[l, c] ]; Nest[f, {}, 100] (* Ray Chandler, Oct 06 2007 *)
PROG
(PARI) nxt(v)=my(t); forprime(p=v[#v]+1, , forstep(i=#v, 3, -1, t=2*v[i]-p; if(t<3, if(i==#v, break, next)); if(setsearch(v, t), next(2))); return(p))
list(n)=my(v=[2]); for(k=2, n, v=concat(v, nxt(v))); v \\ Charles R Greathouse IV, Jan 30 2014
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Jonathan Vos Post, Oct 04 2007
EXTENSIONS
More terms from Ray Chandler, Oct 06 2007.
STATUS
approved