A181616 a(1)=5; thereafter a(2n) = nextprime(a(2n-1)^2), a(2n+1) = nextprime(floor(2*a(2n)/(a(2n-1) + 1))) where nextprime(.) is A007918(.).
5, 29, 11, 127, 23, 541, 47, 2213, 97, 9413, 193, 37253, 389, 151337, 787, 619373, 1579, 2493259, 3163, 10004573, 6329, 40056253, 12659, 160250297, 25321, 641153069, 50647, 2565118639, 101293, 10260271859, 202591, 41043113401, 405199
Offset: 1
Keywords
Examples
Beginning at 5 (n=1), a(2) via nextprime(5^2) = 29. Divisor = ceiling(5/2) = 3 so a(3) = nextprime(floor(29/3)) = 11. Then repeat: a(4) via nextprime(11^2) = 127. Divisor = ceiling(11/2) = 6 so a(5) = nextprime(floor(127/6)) = 23.
Links
- G. C. Greubel, Table of n, a(n) for n = 1..1000
Programs
-
Maple
A007491 := proc(n) nextprime(n^2) ; end proc: A181616 := proc(n) option remember; if n = 1 then 5; elif type(n,'even') then A007491(procname(n-1)) ; else 2*procname(n-1)/(procname(n-2)+1) ; nextprime(floor(%)) ; end if; end proc: # R. J. Mathar, Feb 09 2011
-
Mathematica
a[1] = 5; a[n_] := a[n] = If[OddQ@ n, NextPrime[ a[n - 1]/Ceiling[ a[n - 2]/2]], NextPrime[ a[n - 1]^2]]; Array[a, 33]
-
PARI
\\ example call newseq9(2,50) to use square power, 1st 50 terms \\ I never tried any power but 2 newseq9(a,iend)= { a=floor(a); if(a<2,a=2); i5=5; print(i5); for(n=1,iend, i6=nextprime(i5^a); b=ceil(i5/2); \\ vary as f{i5} i7=nextprime(floor(i6/b)); print(i6); print(i7); i5=i7 ); \\end FOR print("Designed pgm exit (a,b) ...",a," , ",b); }
Comments