OFFSET
1,6
LINKS
Harry J. Smith, Table of n, a(n) for n = 1..1000
FORMULA
a(n) = A373198(n) - 1. - Gus Wiseman, Nov 06 2024
EXAMPLE
Between 113 and 127 the 6 squarefree numbers are 114, 115, 118, 119, 122, 123, so a(30)=6.
From Gus Wiseman, Nov 06 2024: (Start)
The a(n) squarefree numbers for n = 1..16:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
---------------------------------------------------------------
. . 6 10 . 14 . 21 26 30 33 38 42 46 51 55
15 22 34 39 57
35 58
(End)
MAPLE
p:= 2:
for n from 1 to 200 do
q:= nextprime(p);
A[n]:= nops(select(numtheory:-issqrfree, [$p+1..q-1]));
p:= q;
od:
seq(A[i], i=1..200); # Robert Israel, Jan 06 2017
MATHEMATICA
a[n_] := Count[Range[Prime[n]+1, Prime[n+1]-1], _?SquareFreeQ];
Array[a, 100] (* Jean-François Alcover, Feb 28 2019 *)
Count[Range[#[[1]]+1, #[[2]]-1], _?(SquareFreeQ[#]&)]&/@Partition[ Prime[ Range[120]], 2, 1] (* Harvey P. Dale, Oct 14 2021 *)
PROG
(PARI) { n=0; q=2; forprime (p=3, prime(1001), a=0; for (i=q+1, p-1, a+=issquarefree(i)); write("b061398.txt", n++, " ", a); q=p ) } \\ Harry J. Smith, Jul 22 2009
(PARI) a(n) = my(pp=prime(n)+1); sum(k=pp, nextprime(pp)-1, issquarefree(k)); \\ Michel Marcus, Feb 28 2019
(Python)
from math import isqrt
from sympy import mobius, prime, nextprime
def A061398(n):
p = prime(n)
q = nextprime(p)
r = isqrt(p-1)+1
return sum(mobius(k)*((q-1)//k**2) for k in range(r, isqrt(q-1)+1))+sum(mobius(k)*((q-1)//k**2-(p-1)//k**2) for k in range(1, r))-1 # Chai Wah Wu, Jun 01 2024
CROSSREFS
Cf. A179211. [Reinhard Zumkeller, Jul 05 2010]
Counting all composite numbers (not just squarefree) gives A046933.
The version for nonsquarefree numbers is A061399.
Zeros are A068360.
The version for prime-powers is A080101.
Partial sums are A337030.
The version for non-prime-powers is A368748.
Excluding prime(n+1) from the range gives A373198.
Ones are A377430.
Positives are A377431.
The version for perfect-powers is A377432.
The version for non-perfect-powers is A377433 + 2.
For squarefree numbers (A005117) between primes:
- length is A061398 (this sequence)
- min is A112926
- max is A112925
- sum is A373197
For squarefree numbers between powers of two:
- sum is A373123
For primes between powers of two:
- length is A036378
- sum is A293697 (except initial terms)
KEYWORD
nonn,changed
AUTHOR
Labos Elemer, Jun 07 2001
STATUS
approved