A119962 Duplicate of A014234.
3, 7, 13, 31, 61, 127, 251, 509, 1021, 2039, 4093, 8191, 16381, 32749
Offset: 2
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.
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)
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
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 *)
{ 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
a(n) = my(pp=prime(n)+1); sum(k=pp, nextprime(pp)-1, issquarefree(k)); \\ Michel Marcus, Feb 28 2019
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
[ seq( nextprime( 2^i ),i=0..40) ];
NextPrime[ n_Integer] := (k = n + 1; While[ !PrimeQ[k], k++ ]; k); Table[ NextPrime[2^n], {n, 0, 35} ] f[n_] := NextPrime[2^n]; Array[f, 30, 0] (* Robert G. Wilson v, Jun 05 2015 *) NextPrime[2^Range[0,40]] (* Harvey P. Dale, Jun 22 2017 *)
a(n) = nextprime(2^n+1); \\ Michel Marcus, Oct 30 2020
lpp[n_]:=Module[{k=n-1},While[!PrimePowerQ[k],k--];k]; Join[{1},Table[ lpp[ n],{n,Prime[Range[2,60]]}]] (* Harvey P. Dale, Nov 24 2018 *)
from sympy import factorint, prime def A065514(n): return next(filter(lambda m:len(factorint(m))<=1, range(prime(n)-1,0,-1))) # Chai Wah Wu, Oct 25 2024
There are two prime powers between 2179 = A000040(327) and 2203 = A000040(328): 2187 = 3^7 and 2197 = 13^3, therefore a(327) = 2, A080102(327) = 2187 and A080103(327) = 2197.
a := proc(n) local c, k, p: c, p := 0, ithprime(n): for k from p+1 to nextprime(p)-1 do if nops(numtheory:-factorset(k)) = 1 then c := c+1: fi: od: c: end: seq(a(n), n = 1 .. 105); # Lorenzo Sauras Altuzarra, Jul 08 2022
prpwQ[n_]:=Module[{fi=FactorInteger[n]},Length[fi]==1&&fi[[1,2]]>1]; nn=600;With[{pwrs=Table[If[prpwQ[n],1,0],{n,nn}]},Table[Total[ Take[ pwrs,{Prime[n],Prime[n+1]}]],{n,PrimePi[nn]-1}]] (* Harvey P. Dale, Aug 24 2014 *) Table[Length[Select[Range[Prime[n]+1,Prime[n+1]-1],PrimePowerQ]],{n,30}] (* Gus Wiseman, Nov 06 2024 *)
This is the sequence of row-lengths of A005117 treated as a triangle with row-sums A373197: 2 3 5 6 7 10 11 13 14 15 17 19 21 22 23 26 29 30 31 33 34 35 37 38 39 41 42 43 46 47 51 53 55 57 58
Table[Length[Select[Range[Prime[n],Prime[n+1]-1],SquareFreeQ]],{n,100}]
from math import isqrt from sympy import prime, nextprime, mobius def A373198(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)) # Chai Wah Wu, Jun 01 2024
perpowQ[n_]:=n==1||GCD@@FactorInteger[n][[All,2]]>1; Table[NestWhile[#+1&,n,#>1&&!perpowQ[#]&],{n,100}]
from sympy import mobius, integer_nthroot def A377468(n): if n == 1: return 1 def bisection(f,kmin=0,kmax=1): while f(kmax) > kmax: kmax <<= 1 while kmax-kmin > 1: kmid = kmax+kmin>>1 if f(kmid) <= kmid: kmax = kmid else: kmin = kmid return kmax def f(x): return int(x-1+sum(mobius(k)*(integer_nthroot(x,k)[0]-1) for k in range(2,x.bit_length()))) m = n-f(n-1) return bisection(lambda x:f(x)+m,n-1,n) # Chai Wah Wu, Nov 05 2024
Join[{2,2},NextPrime[#]&/@(2^Range[2,40])] (* Harvey P. Dale, Jan 26 2011 *) NextPrime[2^Range[0,50]-1] (* Vladimir Joseph Stephan Orlovsky, Apr 11 2011 *)
g(n,b=2) = for(x=0,n,print1(nextprime(b^x)","))
a(n) = nextprime(2^n); \\ Michel Marcus, Nov 01 2020
For n=4: among the 16 numbers of {16, ..., 31}, nine are squarefree [17, 19, 21, 22, 23, 26, 29, 30, 31], so a(4) = 9.
Table[Apply[Plus, Table[Abs[MoebiusMu[2^w+j]], {j, 0, 2^w-1}]], {w, 0, 15}] (* second program *) Length/@Split[IntegerLength[Select[Range[10000],SquareFreeQ],2]]//Most (* Gus Wiseman, Jun 02 2024 *)
{ a(n) = sum(m=1,sqrtint(2^(n+1)-1), moebius(m) * ((2^(n+1)-1)\m^2 - (2^n-1)\m^2) ) } \\ Max Alekseyev, Oct 18 2008
The twelfth prime is 37, with previous prime-power 32, so a(12) = 5.
Table[Prime[n]-NestWhile[#-1&, Prime[n]-1,#>1&&!PrimePowerQ[#]&],{n,100}]
from sympy import prime, factorint def A377289(n): return (p:=prime(n))-next(filter(lambda m:len(factorint(m))<=1, range(p-1,0,-1))) # Chai Wah Wu, Oct 25 2024
Comments