login
A106044
Difference between n-th prime and next larger perfect square.
11
2, 1, 4, 2, 5, 3, 8, 6, 2, 7, 5, 12, 8, 6, 2, 11, 5, 3, 14, 10, 8, 2, 17, 11, 3, 20, 18, 14, 12, 8, 17, 13, 7, 5, 20, 18, 12, 6, 2, 23, 17, 15, 5, 3, 28, 26, 14, 2, 29, 27, 23, 17, 15, 5, 32, 26, 20, 18, 12, 8, 6, 31, 17, 13, 11, 7, 30, 24, 14, 12, 8, 2, 33, 27, 21, 17, 11, 3, 40, 32, 22
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
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
Cf. A158038 (analog for cubes).
Read as a table, row lengths are A014085 (number of primes between squares).
Row sums are A014085 * A000290(.+1) - A108314.
Sequence in context: A086450 A370153 A270439 * A124896 A008742 A029136
KEYWORD
nonn,easy,tabf
AUTHOR
Zak Seidov, May 06 2005
EXTENSIONS
Edited by M. F. Hasler, Oct 19 2018
STATUS
approved