OFFSET

1,1

COMMENTS

Can be read as a table, since there are always several primes between two squares, although this is the yet unproved Legendre's conjecture, cf. A014085. Whenever a(n+1) > a(n), the n-th prime is the largest one below a given square and prime(n+1) is the smallest prime larger than that square. For n > 1, these are also the indices where the parity of the terms changes. - M. F. Hasler, Oct 19 2018

LINKS

Harvey P. Dale, Table of n, a(n) for n = 1..1000

EXAMPLE

From M. F. Hasler, Oct 19 2018: (Start)

Written as a table, starting a new row when a square is reached, the sequence reads:

2, 1, // 4 - {2, 3: primes between 1^2 = 1 and 2^2 = 4}

4, 2, // 9 - {5, 7: primes between 2^2 = 4 and 3^2 = 9}

5, 3, // 16 - {11, 13: primes between 3^2 = 9 and 4^2 = 16}

8, 6, 2, // 25 - {17, 19, 23: primes between 4^2 = 16 and 5^2 = 25}

7, 5, // 36 - {29, 31: primes between 5^2 = 25 and 6^2 = 36}

12, 8, 6, 2,// 49 - {37, 41, 43, 47: primes between 6^2 = 36 and 7^2 = 49}

11, 5, 3, // 64 - {53, 59, 61: primes between 7^2 = 49 and 8^2 = 64}

14, 10, 8, 2, // 81 - {67, 71, 73, 79: primes between 8^2 = 64 and 9^2 = 81}

17, 11, 3, // 100 - {83, 89, 97: primes between 9^2 = 81 and 10^2 = 100}

etc. (End)

MATHEMATICA

lst={}; Do[p=Prime[n]; s=p^(1/2); f=Floor[s]; a=(f+1)^2; d=a-p; AppendTo[lst, d], {n, 6!}]; lst (* Vladimir Joseph Stephan Orlovsky, Mar 11 2009 *)

(Floor[Sqrt[#]]+1)^2-#&/@Prime[Range[90]] (* Harvey P. Dale, Feb 08 2013 *)

PROG

(PARI) A106044(n)=(sqrtint(n=prime(n))+1)^2-n \\ M. F. Hasler, Oct 19 2018

CROSSREFS

KEYWORD

nonn,easy,tabf

AUTHOR

Zak Seidov, May 06 2005

EXTENSIONS

Edited by M. F. Hasler, Oct 19 2018

STATUS

approved