cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A106044 Difference between n-th prime and next larger perfect square.

This page as a plain text file.
%I A106044 #26 Jan 25 2024 07:53:32
%S A106044 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,
%T A106044 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,
%U A106044 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
%N A106044 Difference between n-th prime and next larger perfect square.
%C A106044 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
%H A106044 Harvey P. Dale, <a href="/A106044/b106044.txt">Table of n, a(n) for n = 1..1000</a>
%e A106044 From _M. F. Hasler_, Oct 19 2018: (Start)
%e A106044 Written as a table, starting a new row when a square is reached, the sequence reads:
%e A106044   2, 1,  // 4 - {2, 3: primes between 1^2 = 1 and 2^2 = 4}
%e A106044   4, 2,   // 9 - {5, 7: primes between 2^2 = 4 and 3^2 = 9}
%e A106044   5, 3,    // 16 - {11, 13: primes between 3^2 = 9 and 4^2 = 16}
%e A106044   8, 6, 2,  // 25 - {17, 19, 23: primes between 4^2 = 16 and 5^2 = 25}
%e A106044   7, 5,      // 36 - {29, 31: primes between 5^2 = 25 and 6^2 = 36}
%e A106044   12, 8, 6, 2,// 49 - {37, 41, 43, 47: primes between 6^2 = 36 and 7^2 = 49}
%e A106044   11, 5, 3,    // 64 - {53, 59, 61: primes between 7^2 = 49 and 8^2 = 64}
%e A106044   14, 10, 8, 2, // 81 - {67, 71, 73, 79: primes between 8^2 = 64 and 9^2 = 81}
%e A106044   17, 11, 3,     // 100 - {83, 89, 97: primes between 9^2 = 81 and 10^2 = 100}
%e A106044   etc. (End)
%t A106044 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 *)
%t A106044 (Floor[Sqrt[#]]+1)^2-#&/@Prime[Range[90]] (* _Harvey P. Dale_, Feb 08 2013 *)
%o A106044 (PARI) A106044(n)=(sqrtint(n=prime(n))+1)^2-n \\ _M. F. Hasler_, Oct 19 2018
%Y A106044 Cf. A158038 (analog for cubes).
%Y A106044 Read as a table, row lengths are A014085 (number of primes between squares).
%Y A106044 Row sums are A014085 * A000290(.+1) - A108314.
%K A106044 nonn,easy,tabf
%O A106044 1,1
%A A106044 _Zak Seidov_, May 06 2005
%E A106044 Edited by _M. F. Hasler_, Oct 19 2018