A378033
Greatest nonsquarefree number <= n, or 1 if there is none (the case n <= 3).
Original entry on oeis.org
1, 1, 1, 4, 4, 4, 4, 8, 9, 9, 9, 12, 12, 12, 12, 16, 16, 18, 18, 20, 20, 20, 20, 24, 25, 25, 27, 28, 28, 28, 28, 32, 32, 32, 32, 36, 36, 36, 36, 40, 40, 40, 40, 44, 45, 45, 45, 48, 49, 50, 50, 52, 52, 54, 54, 56, 56, 56, 56, 60, 60, 60, 63, 64, 64, 64, 64, 68
Offset: 1
The nonsquarefree numbers <= 10 are {4, 8, 9}, so a(10) = 9.
Greatest of the nonsquarefree numbers counted by
A057627.
A112925 gives the greatest squarefree number < prime(n), differences
A378038.
A112926 gives the least squarefree number > prime(n), differences
A378037.
A377046 encodes k-differences of nonsquarefree numbers, zeros
A377050.
-
Table[NestWhile[#-1&,n,#>1&&SquareFreeQ[#]&],{n,100}]
-
a(n) = my(k=n); while (issquarefree(k), k--); if(!k, 1, k); \\ Michel Marcus, Jul 26 2025
A258025
Numbers k such that prime(k+2) - 2*prime(k+1) + prime(k) > 0.
Original entry on oeis.org
1, 3, 5, 7, 8, 10, 13, 14, 17, 20, 22, 23, 26, 28, 29, 31, 33, 35, 38, 41, 43, 45, 49, 50, 52, 57, 60, 61, 64, 65, 67, 69, 70, 71, 75, 76, 78, 79, 81, 83, 85, 86, 89, 90, 93, 95, 96, 98, 100, 104, 105, 109, 113, 116, 117, 120, 122, 123, 124, 126, 131, 134
Offset: 1
5 - 2*3 + 2 = 1, so a(1) = 5.
Adjacent terms differing by 1 correspond to weak prime quartets
A054819.
The version for the Kolakoski sequence is
A156243.
The version for strict descents is
A258026.
The version for weak ascents is
A333230.
The version for weak descents is
A333231.
First differences are
A333212 (if the first term is 0).
Positions of adjacent equal prime gaps are
A064113.
Weakly decreasing runs of compositions in standard order are
A124765.
A triangle counting compositions by strict ascents is
A238343.
Positions of adjacent unequal prime gaps are
A333214.
Lengths of maximal anti-runs of prime gaps are
A333216.
-
u = Table[Sign[Prime[n+2] - 2 Prime[n+1] + Prime[n]], {n, 3, 200}];
Flatten[Position[u, 0]] (* A064113 *)
Flatten[Position[u, 1]] (* A258025 *)
Flatten[Position[u, -1]] (* A258026 *)
Accumulate[Length/@Split[Differences[Array[Prime,100]],#1>=#2&]]//Most (* Gus Wiseman, Mar 25 2020 *)
Position[Partition[Prime[Range[150]],3,1],?(#[[3]]-2#[[2]]+#[[1]]> 0&),1,Heads->False]//Flatten (* _Harvey P. Dale, Dec 25 2021 *)
-
isok(k) = prime(k+2) - 2*prime(k+1) + prime(k) > 0; \\ Michel Marcus, Jun 03 2015
-
is(n,p=prime(n))=my(q=nextprime(p+1),r=nextprime(q+1)); p + r > 2*q
v=List(); n=0; forprime(p=2,1e4, if(is(n++,p), listput(v,n))); v \\ Charles R Greathouse IV, Jun 03 2015
-
from itertools import count, islice
from sympy import prime, nextprime
def A258025_gen(startvalue=1): # generator of terms >= startvalue
c = max(startvalue,1)
p = prime(c)
q = nextprime(p)
r = nextprime(q)
for k in count(c):
if p+r>(q<<1):
yield k
p, q, r = q, r, nextprime(r)
A258025_list = list(islice(A258025_gen(),20)) # Chai Wah Wu, Feb 27 2024
A376562
Second differences of consecutive non-perfect-powers (A007916). First differences of A375706.
Original entry on oeis.org
1, -1, 0, 2, -2, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 1, -1, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 1
The non-perfect powers (A007916) are:
2, 3, 5, 6, 7, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 26, 28, ...
with first differences (A375706):
1, 2, 1, 1, 3, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 2, 1, 1, ...
with first differences (A376562):
1, -1, 0, 2, -2, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 1, -1, 0, ...
Runs of non-perfect-powers:
A112344 counts integer partitions into perfect-powers, factorizations
A294068.
A333254 gives run-lengths of differences between consecutive primes.
For non-perfect-powers:
A375706 (first differences),
A376588 (inflections and undulations),
A376589 (nonzero curvature).
Cf.
A025475,
A052410,
A053707,
A064113,
A069623,
A093555,
A174965,
A182853,
A336416,
A336417,
A361102.
-
radQ[n_]:=n>1&&GCD@@Last/@FactorInteger[n]==1;
Differences[Select[Range[100],radQ],2]
-
from itertools import count
from sympy import mobius, integer_nthroot, perfect_power
def A376562(n):
def f(x): return int(n+1-sum(mobius(k)*(integer_nthroot(x, k)[0]-1) for k in range(2, x.bit_length())))
m, k = n, f(n)
while m != k: m, k = k, f(k)
r = m+((k:=next(i for i in count(1) if not perfect_power(m+i)))<<1)
return next(i for i in count(1-k) if not perfect_power(r+i)) # Chai Wah Wu, Oct 02 2024
A376590
Second differences of consecutive squarefree numbers (A005117). First differences of A076259.
Original entry on oeis.org
0, 1, -1, 0, 2, -2, 1, -1, 0, 1, 0, 0, -1, 0, 2, 0, -2, 0, 1, -1, 0, 1, -1, 0, 1, -1, 0, 2, -2, 3, -2, 0, 0, -1, 0, 1, -1, 2, -2, 0, 1, -1, 0, 1, -1, 2, -2, 0, 2, -2, 1, -1, 0, 1, 0, 0, -1, 0, 1, 2, -3, 0, 1, -1, 0, 1, -1, 0, 1, -1, 0, 2, -2, 2, -2, 3, -2, -1
Offset: 1
The squarefree numbers (A005117) are:
1, 2, 3, 5, 6, 7, 10, 11, 13, 14, 15, 17, 19, 21, 22, 23, 26, 29, 30, 31, 33, 34, ...
with first differences (A076259):
1, 1, 2, 1, 1, 3, 1, 2, 1, 1, 2, 2, 2, 1, 1, 3, 3, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, ...
with first differences (A376590):
0, 1, -1, 0, 2, -2, 1, -1, 0, 1, 0, 0, -1, 0, 2, 0, -2, 0, 1, -1, 0, 1, -1, 0, 1, ...
Sorted positions of first appearances are
A376655.
A073576 counts integer partitions into squarefree numbers, factorizations
A050320.
A333254 lists run-lengths of differences between consecutive primes.
For squarefree numbers:
A076259 (first differences),
A376591 (inflections and undulations),
A376592 (nonzero curvature),
A376655 (sorted first positions).
Cf.
A000961,
A007674,
A053797,
A053806,
A061398,
A072284,
A112925,
A112926,
A120992,
A251092,
A373198,
A376342.
-
Differences[Select[Range[100],SquareFreeQ],2]
-
from math import isqrt
from sympy import mobius
def A376590(n):
def iterfun(f,n=0):
m, k = n, f(n)
while m != k: m, k = k, f(k)
return m
def f(x): return n+x-sum(mobius(k)*(x//k**2) for k in range(1, isqrt(x)+1))
a = iterfun(f,n)
b = iterfun(lambda x:f(x)+1,a)
return a+iterfun(lambda x:f(x)+2,b)-(b<<1) # Chai Wah Wu, Oct 02 2024
A258026
Numbers k such that prime(k+2) - 2*prime(k+1) + prime(k) < 0.
Original entry on oeis.org
4, 6, 9, 11, 12, 16, 18, 19, 21, 24, 25, 27, 30, 32, 34, 37, 40, 42, 44, 47, 48, 51, 53, 56, 58, 59, 62, 63, 66, 68, 72, 74, 77, 80, 82, 84, 87, 88, 91, 92, 94, 97, 99, 101, 103, 106, 108, 111, 112, 114, 115, 119, 121, 125, 127, 128, 130, 132, 133, 135, 137
Offset: 1
The prime gaps split into the following maximal weakly increasing subsequences: (1,2,2,4), (2,4), (2,4,6), (2,6), (4), (2,4,6,6), (2,6), (4), (2,6), (4,6,8), (4), (2,4), (2,4,14), ... Then a(n) is the n-th partial sum of the lengths of these subsequences. - _Gus Wiseman_, Mar 24 2020
Adjacent terms differing by 1 correspond to strong prime quartets
A054804.
The version for the Kolakoski sequence is
A156242.
First differences are
A333215 (if the first term is 0).
The version for strict ascents is
A258025.
The version for weak ascents is
A333230.
The version for weak descents is
A333231.
Positions of adjacent equal prime gaps are
A064113.
Weakly increasing runs of compositions in standard order are
A124766.
Strictly decreasing runs of compositions in standard order are
A124769.
Cf.
A000040,
A000720,
A001221,
A036263,
A054819,
A084758,
A124765,
A124768,
A333212,
A333213,
A333214,
A333256.
-
u = Table[Sign[Prime[n+2] - 2 Prime[n+1] + Prime[n]], {n, 1, 200}];
Flatten[Position[u, 0]] (* A064113 *)
Flatten[Position[u, 1]] (* A258025 *)
Flatten[Position[u, -1]] (* A258026 *)
Accumulate[Length/@Split[Differences[Array[Prime,100]],LessEqual]]//Most (* Gus Wiseman, Mar 24 2020 *)
-
from itertools import count, islice
from sympy import prime, nextprime
def A258026_gen(startvalue=1): # generator of terms >= startvalue
c = max(startvalue,1)
p = prime(c)
q = nextprime(p)
r = nextprime(q)
for k in count(c):
if p+r<(q<<1):
yield k
p, q, r = q, r, nextprime(r)
A258026_list = list(islice(A258026_gen(),20)) # Chai Wah Wu, Feb 27 2024
A376559
Second differences of consecutive perfect powers (A001597). First differences of A053289.
Original entry on oeis.org
1, -3, 6, 2, -7, 3, -1, 9, 2, 2, 2, 2, -17, -1, 13, 9, 2, -7, -11, 9, -5, 20, 2, -16, -1, 21, 2, 2, -15, -11, 30, 2, 2, 2, 2, 2, 2, 2, -22, -15, 41, 2, 2, 2, -36, 3, 37, 2, 2, 2, -34, -11, 49, 2, 2, -66, 45, 3, -61, 2, 83, 2, 2, 2, 2, -63, 25, 42, 2, -9, -89
Offset: 1
The perfect powers (A001597) are:
1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, 128, 144, 169, 196, ...
with first differences (A053289):
3, 4, 1, 7, 9, 2, 5, 4, 13, 15, 17, 19, 21, 4, 3, 16, 25, 27, 20, 9, 18, 13, ...
with first differences (A376559):
1, -3, 6, 2, -7, 3, -1, 9, 2, 2, 2, 2, -17, -1, 13, 9, 2, -7, -11, 9, -5, 20, ...
A112344 counts integer partitions into perfect-powers, factorizations
A294068.
For perfect-powers:
A053289 (first differences),
A376560 (positive curvature),
A376561 (negative curvature).
Cf.
A045542,
A052410,
A053707,
A064113,
A069623,
A174965,
A216765,
A251092,
A333254,
A336416,
A361102.
-
perpowQ[n_]:=n==1||GCD@@FactorInteger[n][[All,2]]>1;
Differences[Select[Range[1000],perpowQ],2]
-
lista(nn) = my(v = concat (1, select(ispower, [1..nn])), w = vector(#v-1, i, v[i+1] - v[i])); vector(#w-1, i, w[i+1] - w[i]); \\ Michel Marcus, Oct 02 2024
-
from sympy import mobius, integer_nthroot
def A376559(n):
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(n-1+x+sum(mobius(k)*(integer_nthroot(x,k)[0]-1) for k in range(2,x.bit_length())))
a = bisection(f,n,n)
b = bisection(lambda x:f(x)+1,a,a)
return a+bisection(lambda x:f(x)+2,b,b)-(b<<1) # Chai Wah Wu, Oct 02 2024
A376599
Second differences of consecutive non-prime-powers inclusive (A024619). First differences of A375735.
Original entry on oeis.org
-2, 0, -1, 2, -1, -1, 0, 1, 0, 0, 0, 1, -2, 0, 0, 1, -1, 0, 1, 0, -1, 0, 1, 0, -1, 0, 1, -1, 0, 0, 0, 1, 0, -1, 1, -1, 1, -1, 0, 1, 0, -1, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 1, -1, 0, 1, 0, -1, 0, 1, 0, -1, 0, 1, -1, 0, 0, 0, 0, 0, 1, -1, 0
Offset: 1
The non-prime-powers inclusive (A024619) are:
6, 10, 12, 14, 15, 18, 20, 21, 22, 24, 26, 28, 30, 33, 34, 35, 36, 38, 39, 40, ...
with first differences (A375735):
4, 2, 2, 1, 3, 2, 1, 1, 2, 2, 2, 2, 3, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, ...
with first differences (A376599):
-2, 0, -1, 2, -1, -1, 0, 1, 0, 0, 0, 1, -2, 0, 0, 1, -1, 0, 1, 0, -1, 0, 1, 0, ...
-
Differences[Select[Range[100],!(#==1||PrimePowerQ[#])&],2]
-
from sympy import primepi, integer_nthroot
def A376599(n):
def iterfun(f,n=0):
m, k = n, f(n)
while m != k: m, k = k, f(k)
return m
def f(x): return int(n+1+sum(primepi(integer_nthroot(x,k)[0]) for k in range(1,x.bit_length())))
return (a:=iterfun(f,n))-((b:=iterfun(lambda x:f(x)+1,a))<<1)+iterfun(lambda x:f(x)+2,b) # Chai Wah Wu, Oct 02 2024
A378032
a(1) = a(2) = 1; a(n>2) is the greatest nonsquarefree number < prime(n).
Original entry on oeis.org
1, 1, 4, 4, 9, 12, 16, 18, 20, 28, 28, 36, 40, 40, 45, 52, 56, 60, 64, 68, 72, 76, 81, 88, 96, 100, 100, 104, 108, 112, 126, 128, 136, 136, 148, 150, 156, 162, 164, 172, 176, 180, 189, 192, 196, 198, 208, 220, 225, 228, 232, 236, 240, 250, 256, 261, 268, 270
Offset: 1
The terms together with their prime indices begin:
1: {}
1: {}
4: {1,1}
4: {1,1}
9: {2,2}
12: {1,1,2}
16: {1,1,1,1}
18: {1,2,2}
20: {1,1,3}
28: {1,1,4}
28: {1,1,4}
36: {1,1,2,2}
40: {1,1,1,3}
40: {1,1,1,3}
45: {2,2,3}
52: {1,1,6}
56: {1,1,1,4}
60: {1,1,2,3}
64: {1,1,1,1,1,1}
68: {1,1,7}
72: {1,1,1,2,2}
Terms appearing twice are
A061351 + 1.
A005117 lists the squarefree numbers.
A070321 gives the greatest squarefree number up to n.
A377046 encodes k-differences of nonsquarefree numbers, zeros
A377050.
-
Table[NestWhile[#-1&,Prime[n],#>1&&SquareFreeQ[#]&],{n,100}]
A054804
First term of strong prime quartets: prime(m+1)-prime(m) > prime(m+2)-prime(m+1) > prime(m+3)-prime(m+2).
Original entry on oeis.org
31, 61, 89, 211, 271, 293, 449, 467, 607, 619, 709, 743, 839, 863, 919, 1069, 1291, 1409, 1439, 1459, 1531, 1637, 1657, 1669, 1723, 1759, 1777, 1831, 1847, 1861, 1979, 1987, 2039, 2131, 2311, 2357, 2371, 2447, 2459, 2477, 2503, 2521, 2557, 2593, 2633
Offset: 1
The first 10 strictly decreasing prime gap quartets:
31 37 41 43
61 67 71 73
89 97 101 103
211 223 227 229
271 277 281 283
293 307 311 313
449 457 461 463
467 479 487 491
607 613 617 619
619 631 641 643
For example, the primes (211,223,227,229) have differences (12,4,2), which are strictly decreasing, so 211 is in the sequence.
The second and third term of each quadruplet are consecutive terms in A051634: this is a characteristic property of this sequence. - _M. F. Hasler_, Jun 01 2020
All of the following use prime indices rather than the primes themselves:
- Strictly decreasing prime gap quartets are
A335278.
- Strictly increasing prime gap quartets are
A335277.
- Equal prime gap quartets are
A090832.
- Weakly increasing prime gap quartets are
A333383.
- Weakly decreasing prime gap quartets are
A333488.
- Unequal prime gap quartets are
A333490.
- Partially unequal prime gap quartets are
A333491.
- Adjacent equal prime gaps are
A064113.
- Strict ascents in prime gaps are
A258025.
- Strict descents in prime gaps are
A258026.
- Adjacent unequal prime gaps are
A333214.
- Weak ascents in prime gaps are
A333230.
- Weak descents in prime gaps are
A333231.
Maximal weakly increasing intervals of prime gaps are
A333215.
Maximal strictly decreasing intervals of prime gaps are
A333252.
Cf. also
A000040,
A006560,
A031217,
A054800,
A054805,
A054806,
A054807,
A059044,
A084758,
A089180,
A333253,
A335278.
-
primes:= select(isprime,[seq(i,i=3..10000,2)]):
L:= primes[2..-1]-primes[1..-2]:
primes[select(t -> L[t+2] < L[t+1] and L[t+1] < L[t], [$1..nops(L)-2])]; # Robert Israel, Jun 28 2018
-
ReplaceList[Array[Prime,100],{_,x_,y_,z_,t_,_}/;y-x>z-y>t-z:>x] (* Gus Wiseman, May 31 2020 *)
Select[Partition[Prime[Range[400]],4,1],Max[Differences[#,2]]<0&][[All,1]] (* Harvey P. Dale, Jan 12 2023 *)
A377046
Array read by downward antidiagonals where A(n,k) is the n-th term of the k-th differences of nonsquarefree numbers.
Original entry on oeis.org
4, 8, 4, 9, 1, -3, 12, 3, 2, 5, 16, 4, 1, -1, -6, 18, 2, -2, -3, -2, 4, 20, 2, 0, 2, 5, 7, 3, 24, 4, 2, 2, 0, -5, -12, -15, 25, 1, -3, -5, -7, -7, -2, 10, 25, 27, 2, 1, 4, 9, 16, 23, 25, 15, -10, 28, 1, -1, -2, -6, -15, -31, -54, -79, -94, -84, 32, 4, 3, 4, 6, 12, 27, 58, 112, 191, 285, 369
Offset: 0
Array form:
n=1: n=2: n=3: n=4: n=5: n=6: n=7: n=8: n=9:
---------------------------------------------------------
k=0: 4 8 9 12 16 18 20 24 25
k=1: 4 1 3 4 2 2 4 1 2
k=2: -3 2 1 -2 0 2 -3 1 -1
k=3: 5 -1 -3 2 2 -5 4 -2 4
k=4: -6 -2 5 0 -7 9 -6 6 -7
k=5: 4 7 -5 -7 16 -15 12 -13 10
k=6: 3 -12 -2 23 -31 27 -25 23 -13
k=7: -15 10 25 -54 58 -52 48 -36 13
k=8: 25 15 -79 112 -110 100 -84 49 1
k=9: -10 -94 191 -222 210 -184 133 -48 -57
Triangle form:
4
8 4
9 1 -3
12 3 2 5
16 4 1 -1 -6
18 2 -2 -3 -2 4
20 2 0 2 5 7 3
24 4 2 2 0 -5 -12 -15
25 1 -3 -5 -7 -7 -2 10 25
27 2 1 4 9 16 23 25 15 -10
28 1 -1 -2 -6 -15 -31 -54 -79 -94 -84
32 4 3 4 6 12 27 58 112 191 285 369
First position of 0 in each row is
A377050.
For prime-power instead of nonsquarefree we have
A377051.
A005117 lists the squarefree numbers.
A073576 counts integer partitions into squarefree numbers, factorizations
A050320.
Cf.
A000961,
A007674,
A053797,
A053806,
A061398,
A072284,
A112925,
A120992,
A376311,
A376591,
A376592.
-
nn=9;
t=Table[Take[Differences[NestList[NestWhile[#+1&,#+1,SquareFreeQ[#]&]&,4,2*nn],k],nn],{k,0,nn}]
Table[t[[j,i-j+1]],{i,nn},{j,i}]
Comments