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.

A104477 Number of successive squarefree intervals between primes.

This page as a plain text file.
%I A104477 #19 Sep 01 2024 19:21:55
%S A104477 1,0,1,0,1,0,2,0,1,0,3,0,2,0,3,0,2,0,4,0,3,0,4,0,4,0,3,0,5,0,6,0,4,0,
%T A104477 5,0,5,0,6,0,6,0,6,0,5,0,8,0,7,0,6,0,7,0,8,0,7,0,7,0,9,0,8,0,9,0,8,0,
%U A104477 9,0,8,0,8,0,11,0,10,0,11,0,10,0,8,0,11,0,10,0,12,0,9,0,12,0,14,0,9,0,10,0
%N A104477 Number of successive squarefree intervals between primes.
%C A104477 Find the number (the "run length") of successive intervals [p, p'=nextprime(p)] (followed by [p', p''], then [p'', p'''] etc.) which do not contain a square. When a square (n+1)^2 is found in such an interval, this will result in a term a(2n) = 0, preceded by a(2n-1) = the number of intervals of primes counted before reaching that square, i.e., between n^2 and (n+1)^2. - _M. F. Hasler_, Oct 01 2018
%H A104477 Vincenzo Librandi, <a href="/A104477/b104477.txt">Table of n, a(n) for n = 1..10000</a>
%F A104477 a(2n) = 0: this is the interval from the greatest prime less than the (n+1)th square, through that square and up to the least prime greater than that square. - _Robert G. Wilson v_, Apr 23 2005
%F A104477 a(2n-1) = the difference between the indices of the greatest prime less than (n+1)^2 and the least prime greater than n^2. - _Robert G. Wilson v_, Apr 23 2005
%F A104477 a(2n-1) = A014085(n) - 1 = primepi((n+1)^2) - primepi(n^2) - 1. - _M. F. Hasler_, Oct 01 2018
%e A104477 a(1)=1 because the first interval between primes (2 to 3) is free of squares.
%e A104477 a(2)=0 because there is a square between 3 and 5.
%e A104477 a(7)=2 because there are two successive squarefree intervals: 17 to 19; and 19 to 23.
%e A104477 a(8)=0 because between 23 and 29 there is a square: 25.
%t A104477 NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; PrevPrim[n_] := Block[{k = n - 1}, While[ !PrimeQ[k], k-- ]; k]; f[n_] := If[ EvenQ[n], 0, PrimePi[ PrevPrim[(n + 3)^2/4]] - PrimePi[ NextPrim[(n + 1)^2/4]]]; Table[ f[n], {n, 100}] (* _Robert G. Wilson v_, Apr 23 2005 *)
%o A104477 (PARI) p=2; c=0; forprime(np=p+1, 1e4, if( sqrtint(p) < sqrtint(np), print1(c",",c=0,","), c++); p=np) \\ For illustrative purpose. Better:
%o A104477 A104477(n)=if(bittest(n,0),primepi((1+n\/=2)^2)-primepi(n^2)-1,0) \\ _M. F. Hasler_, Oct 01 2018
%Y A104477 Cf. A061265, A031265, A104481.
%Y A104477 Equals A014085 - 1 without the initial term, interleaved with 0's.
%K A104477 easy,nonn
%O A104477 1,7
%A A104477 _Alexandre Wajnberg_, Apr 18 2005
%E A104477 More terms from _Robert G. Wilson v_, Apr 23 2005
%E A104477 Offset corrected by _M. F. Hasler_, Oct 01 2018