login
Primeth recurrence: a(n) = (a(n-1)+a(n-2))-th prime, with a(0)=0, a(1)=1.
1

%I #20 May 25 2024 23:39:54

%S 0,1,2,5,17,79,503,4243,45823,612809,9903031,189244327,4203344543,

%T 106963067069,3081230793857,99460155441599,3566360917197283,

%U 140987300677114811,6104597616658111069,287835273618906460259

%N Primeth recurrence: a(n) = (a(n-1)+a(n-2))-th prime, with a(0)=0, a(1)=1.

%t RecurrenceTable[{a[n] == Prime[a[n - 1] + a[n - 2]], a[0] == 0,

%t a[1] == 1}, a, {n, 0, 14}] (* _Michael De Vlieger_, Jul 01 2015 *)

%o (PARI) a(n)=if(n<3,n,prime(a(n-1)+a(n-2))) \\ _Charles R Greathouse IV_, Jul 13 2015

%o (PARI) main(size)={my(v=vector(size),i);v[1]=0;v[2]=1;for(i=3,size,v[i]=prime(v[i-1]+v[i-2]));return(v);} /* _Anders Hellström_, Jul 13 2015 */

%o (Perl) use bignum;

%o use Math::Prime::Util ':all';

%o $|=1;

%o my $a=0, $b=1;

%o while(1){

%o ($a,$b)=($b,nth_prime($a+$b));

%o print("$b, ")

%o } # _Charles R Greathouse IV_, Jul 13 2015

%K nonn

%O 0,3

%A _Christopher Halverson_, Jul 01 2015

%E a(7)-a(14) from _Michael De Vlieger_, Jul 01 2015

%E a(15)-a(18) from _Charles R Greathouse IV_, Jul 13 2015

%E a(19) from _Charles R Greathouse IV_, Jul 14 2015