Samuel Harkness has authored 29 sequences. Here are the ten most recent ones:
A381537
Lexicographically least sequence of natural numbers such that for all arithmetic progressions p, length(p) <= sqrt(max(p)).
Original entry on oeis.org
1, 4, 5, 8, 9, 10, 12, 15, 16, 17, 18, 22, 23, 24, 25, 26, 28, 29, 30, 31, 33, 35, 36, 37, 38, 39, 40, 42, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 57, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 76, 81, 82, 83, 84, 85, 86, 87, 88, 90, 91, 92
Offset: 1
1 is in the sequence, as 1 creates the arithmetic progression p = {1}, where length(p) = 1 and sqrt(max(p)) = 1.
For 2: the arithmetic progression p = {1,2} would be created. Here, length(p) = 2, and sqrt(max(p)) = sqrt(2), so length(p) > sqrt(max(p)), thus 2 is not in the sequence. Similarly, 3 is not in the sequence.
For 4: p = {1,4} is the only new arithmetic progression. Here, length(p) = 2, and sqrt(max(p)) = 2, so 4 is in the sequence. Similarly, 5 is in the sequence.
For 6: the arithmetic progression p = {4,5,6} would be created. Here, length(p) = 3, and sqrt(max(p)) = sqrt(6), so length(p) > sqrt(max(p)), thus 6 is not in the sequence.
A372406
a(n) is the size of the largest set of positive integers S from 1..prime(n)-1 such that for any subset R of S, Sum {R} + prime(n) is prime.
Original entry on oeis.org
1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 3, 4, 4, 4, 4, 3, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
Offset: 1
Let n=5, so p=prime(5)=11. From A070046, there are 3 positive integers x such that 1 <= x < 11 and 11+x is prime, which are {2, 6, 8}, so a(5) <= 3. Next, we see that 11 + 2 + 6 + 8 = 27 which is not prime so a(5) < 3. Last, we see that 11 + 2 + 6 = 19 is prime, and we already checked that 11 + 2 and 11 + 6 were prime, so S = {2, 6} and a(5) = 2.
11 is the first n such that a(n) = 3. Here, prime(11) = 31, and there are multiple sets which work. One is S = {6, 22, 30}.
31 + {} = 31 (empty set subset of S),
31 + 6 = 37,
31 + 22 = 53,
31 + 30 = 61,
31 + 6 + 22 = 59,
31 + 6 + 30 = 67,
31 + 22 + 30 = 83,
31 + 6 + 22 + 30 = 89, all of which are prime.
28 is the first n such that a(n) = 4. Here, prime(28) = 107, and there are multiple sets which work. One is S = {2, 30, 42, 90}.
-
f:= proc(n)
local k,p,C,S,s,t,q;
p:= ithprime(n);
C:= select(isprime,[$p+1 .. 2*p-1]) -~ p;
S[1]:= map(t -> [{t},{0,t}],C);
for k from 2 do
S[k]:= NULL;
for s in S[k-1] do
for t in select(`>`,C,max(s[1])) do
q:= s[2] +~ t;
if andmap(isprime, q +~ p) then
S[k]:= S[k], [s[1] union {t}, s[2] union q] ;
fi
od od;
S[k]:= {S[k]};
if S[k] = {} then return k-1 fi
od
end proc:
map(f, [$1..90]); # Robert Israel, May 06 2024
-
nmax = 87; a372406 = {{1, 1}};
For[n = 2, n <= nmax, n++, d = {}; p = Prime[n];
For[a = 2, a < p, a += 2, If[PrimeQ[p + a], AppendTo[d, a]]]; q = 1; k = 0;
While[q == 1 && k <= Length[d], k++; su = Subsets[d, {k}];
For[i = 1, i <= Length[su], i++, s = su[[i]];
If[PrimeQ[Total[s] + p], y = Subsets[s]; t = 1;
For[z = 1, z <= Length[y], z++,
If[CompositeQ[Total[y[[z]]] + p], t = 0; q = 0; Break[]]];
If[t == 1, q = 1; Break[]], q = 0]]];
AppendTo[a372406, {n, k - 1}]]
Print[a372406]
A371924
a(n) is the least b such that prime(n)-1 divides b!.
Original entry on oeis.org
1, 2, 4, 3, 5, 4, 6, 6, 11, 7, 5, 6, 5, 7, 23, 13, 29, 5, 11, 7, 6, 13, 41, 11, 8, 10, 17, 53, 9, 7, 7, 13, 17, 23, 37, 10, 13, 9, 83, 43, 89, 6, 19, 8, 14, 11, 7, 37, 113, 19, 29, 17, 6, 15, 10, 131, 67, 9, 23, 7, 47, 73, 17, 31, 13, 79, 11, 7, 173, 29, 11
Offset: 1
For n = 25, prime(25) = 97, so we will use p = 97. Then the prime factorization of p - 1 is p - 1 = 2^5 * 3. Note that for p - 1 to divide b!, the exponents for all prime factors in b! must be greater than or equal to the exponents for all prime factors in the prime factorization of p - 1. We find that 8! = 2^7 * 3^2 * 5 * 7 is the least b such that this is true, so a(25) = 8.
-
a371924[p_] :=
Module[{a, d, f, u, v}, f = FactorInteger[p - 1]; d = {};
For[a = 1, a <= Length[f], a++,
u = f[[a]];
v = u[[1]]^u[[2]];
i = 1;
While[! Divisible[(u[[1]]*i)!, v], i++]; AppendTo[d, u[[1]]*i]];
Return[Max[d]]]
list = {};
For[p = 1, p <= 71, p++,
AppendTo[list, {p, a371924[Prime[p]]}]]
Print[list]
-
a(n) = my(b=1, q=prime(n)-1); while (b! % q, b++); b; \\ Michel Marcus, Apr 15 2024
-
from sympy import prime
def A371924(n):
m = prime(n)-1
b, k = 1, 1%m
while k:
b += 1
k = k*b%m
return b # Chai Wah Wu, Apr 25 2024
A366625
Lexicographically earliest sequence of positive integers such that each multiset enclosed by two equal terms, excluding the endpoints, is distinct.
Original entry on oeis.org
1, 1, 2, 1, 2, 3, 1, 2, 4, 1, 2, 3, 2, 1, 5, 1, 2, 3, 4, 1, 2, 3, 4, 2, 1, 5, 3, 1, 2, 4, 2, 1, 5, 3, 4, 1, 2, 6, 1, 2, 3, 4, 5, 1, 2, 4, 3, 7, 1, 2, 3, 4, 5, 3, 1, 2, 6, 2, 1, 3, 4, 5, 7, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 7, 2, 1, 3, 4, 5, 6, 1, 2, 4, 3, 5, 8, 1
Offset: 1
a(15) = 5: a(15) cannot be 1 since this would form the empty multiset with a(14) = 1. a(15) cannot be 2 because this would form the multiset [2 1 2] = {1}, which already occurred at [2 1 2] = {1}. a(15) cannot be 3 because this would form the multiset [3 2 1 3] = {1, 2}, which already occurred at [1 1 2 1] = {1, 2}. a(15) cannot be 4 because this would form the multiset [4 1 2 3 2 1 4] = {1, 1, 2, 2, 3}, which already occurred at [1 1 2 1 2 3 1] = {1, 1, 2, 2, 3}. a(15) = 5 because 5 is a first occurrence and thus creates no new multisets.
For this sequence, the multisets between k and all other occurrences of k must be checked. The first instance such that this is the sole reason for restricting a possible value is when considering 2 for a(27).
a(27) != 2 since 2 there would cause two enclosed multisets with the same 5 terms (in different order, which doesn't matter for a multiset),
n = 15 19 22 26 27
a(n) = 1 5 1 2 3 4 1 2 3 4 2 1 5 [2]
|-------| |-------|
There are also instances where overlapping conflicting regions are the sole reason for restricting a possible value.
a(74) != 5 since 5 there would cause two enclosed multisets with the same 20 terms,
n = 38 54
a(n) = 2 6 1 2 3 4 5 1 2 4 3 7 1 2 3 4 5 3 1
|----------------------------------
|--
n = 57 73
a(n) = 2 6 2 1 3 4 5 7 1 2 3 4 5 6 1 2 3 4[5]
--|
----------------------------------|
-
See Links section.
-
from itertools import islice
def agen(): # generator of terms
m, a = set(), []
while True:
an, allnew = 0, False
while not allnew:
allnew, an, mn = True, an+1, set()
for i in range(len(a)):
if an == a[i]:
t = tuple(sorted(a[i+1:]))
if t in m or t in mn: allnew = False; break
mn.add(t)
yield an; a.append(an); m |= mn
print(list(islice(agen(), 87))) # Michael S. Branicky, Oct 25 2023
A366312
Index of first occurrence of n in A366311.
Original entry on oeis.org
1, 5, 7, 9, 28, 47, 1031, 745771, 115318369671
Offset: 1
-
/* See Ryde link. */
-
% See Harkness link.
A364057
Lexicographically earliest infinite sequence of positive integers such that every subsequence {a(j), a(j+k), a(j+2k)} (j, k >= 1) is unique.
Original entry on oeis.org
1, 1, 1, 2, 3, 1, 2, 4, 5, 6, 7, 8, 5, 1, 2, 9, 3, 4, 6, 7, 1, 10, 11, 12, 13, 8, 14, 15, 16, 3, 17, 9, 18, 4, 7, 19, 5, 2, 11, 12, 20, 6, 1, 8, 21, 22, 9, 23, 24, 13, 14, 3, 10, 16, 17, 25, 26, 19, 27, 6, 28, 11, 15, 20, 22, 29, 12, 21, 16, 23, 30, 18, 31, 32
Offset: 1
For a(9), we first try 1. If a(9) were 1, {a(3), a(6), a(9)} would be {1, 1, 1}, but this already occurred at {a(1), a(2), a(3)}.
Next, try 2. If a(9) were 2, {a(3), a(6), a(9)} would be {1, 1, 2}, but this already occurred at {a(2), a(3), a(4)}.
Next, try 3. If a(9) were 3, {a(3), a(6), a(9)} would be {1, 1, 3}, but this already occurred at {a(1), a(3), a(5)}.
Next, try 4. If a(9) were 4, {a(1), a(5), a(9)} would be {1, 3, 4}, but this already occurred at {a(2), a(5), a(8)}.
Then, try 5. New subsequences at indices {a(1), a(5), a(9)} = {1, 3, 5}, {a(3), a(6), a(9)} = {1, 1, 5}, {a(5), a(7), a(9)} = {3, 2, 5}, and {a(7), a(8), a(9)} = {2, 4, 5} are formed, none of which have occurred at any {a(j), a(j+k), a(j+2k)} (for any j and k) previously. No 5 has occurred previously, so criteria (2) in Comments must be satisfied. Thus a(9) = 5.
a(10) is the first time a candidate is denied solely because it would create a guaranteed future duplicate. Note that no subsequences prevent a(10) from being 4.
n = 1 2 3 4 5 6 7 8 9 10 11 12 13 14
a(n) = 1 1 1 2 3 1 2 4 5 [4] X
| | |
| | |
If a(10) were 4, {a(2), a(8), a(14)} = {a(6), a(10), a(14)} = {1, 4, X}, making a subsequence {a(j), a(j+k), a(j+2k)} which is not unique. Therefore a(10) != 4.
A366624
Lexicographically earliest sequence of positive integers such that each subsequence enclosed by two equal terms, not including the endpoints, is distinct.
Original entry on oeis.org
1, 1, 2, 1, 2, 3, 1, 2, 4, 1, 2, 3, 2, 1, 3, 2, 1, 4, 1, 2, 3, 4, 1, 2, 3, 5, 1, 2, 3, 4, 2, 1, 3, 4, 2, 1, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 6, 1, 2, 3, 4, 5, 2, 1, 3, 4, 5, 2, 1, 4, 2, 1, 3, 5, 1, 2, 4, 3, 1, 2, 4, 3, 2, 1, 4, 3, 2, 1, 5, 2, 1, 3, 4, 6, 1, 2, 4
Offset: 1
For a(9), we first try 1. If a(9) were 1, {a(8)} = {2} would be bounded by a(7) = a(9) = 1, but {2} is already bounded by a(2) = a(4) = 1.
Next, try 2. Note this would create consecutive values at {a(8), a(9)}, enclosing the empty subsequence, but this already occurred at {a(1), a(2)}.
Next, try 3. If a(9) were 3, {a(7), a(8)} = {1, 2} would be bounded by a(6) = a(9) = 3, but {1, 2} is already bounded by a(1) = a(4) = 1.
Next, try 4. 4 has yet to appear, so a(9) = 4.
-
/* See links */
-
See Links section.
-
from itertools import islice
def agen(): # generator of terms
m, a = set(), []
while True:
an, allnew = 0, False
while not allnew:
allnew, an, mn = True, an+1, set()
for i in range(len(a)):
if an == a[i]:
t = tuple(a[i+1:])
if t in m or t in mn: allnew = False; break
mn.add(t)
yield an; a.append(an); m |= mn
print(list(islice(agen(), 87))) # Michael S. Branicky, Jan 15 2024
A366311
Lexicographically earliest sequence of positive integers on a square spiral such that there are no palindromes with length > 2 in any row, column or diagonal.
Original entry on oeis.org
1, 1, 1, 1, 2, 2, 3, 2, 4, 3, 3, 4, 2, 3, 4, 4, 2, 3, 3, 4, 2, 3, 4, 4, 2, 2, 2, 5, 3, 2, 2, 2, 4, 5, 3, 2, 4, 1, 1, 5, 4, 1, 1, 1, 5, 5, 6, 1, 1, 2, 1, 5, 4, 1, 1, 3, 3, 1, 5, 5, 3, 2, 1, 3, 3, 1, 4, 5, 1, 2, 4, 3, 1, 2, 3, 5, 1, 1, 3, 3, 4, 1, 3, 6, 4, 1, 1
Offset: 1
For a(45), first consider the west direction. The nearest cells are "1 1", so a(45) cannot be 1, as this would create "1 1 1". Next, consider the northwest direction. The nearest cells are "2 4", so a(45) cannot be 4, as this would create "4 2 4". Then, consider the north direction. From the Proof above only the 3 nearest cells need to be considered (unless the two closest are unequal, in which case only the 2 nearest). The nearest cells are "3 3 2", so a(45) cannot be 3, as this would create "3 3 3", and a(45) cannot be 2, as this would create "2 3 3 2". Last, consider the northeast direction. The nearest cells are "4 4 3", so a(45) cannot be 4 or 3, as we already know. Thus, a(45) cannot be 1, 2, 3, or 4, so a(45)=5.
.
4 2 3 5 4 2 2
1 2 4 4 3 2 2
1 3 2 1 1 4 3
5 3 2 1 1 3 5
4 4 3 2 4 3 2
1 2 3 4 4 2 2
1 1 a(45)
.
The first 144 terms:
4---2---1---4---6---2---4---1---3---2---2---1
|
2---4---1---3---2---4---1---1---3---4---1 1
| | |
2 3---3---1---2---3---5---5---1---3 4 4
| | | | |
3 1 4---2---3---5---4---2---2 3 4 5
| | | | | | |
6 4 1 2---4---4---3---2 2 1 3 2
| | | | | | | | |
2 5 1 3 2---1---1 4 3 1 1 2
| | | | | | | | | | |
2 1 5 3 2 1---1 3 5 4 1 3
| | | | | | | | | |
3 2 4 4 3---2---4---3 2 5 4 3
| | | | | | | |
3 4 1 2---3---4---4---2---2 1 6 5
| | | | | |
5 3 1---1---5---5---6---1---1---2 3 4
| | | |
4 1---2---3---5---1---1---3---3---4---1 2
| |
3---2---2---6---4---3---2---4---4---3---2---1
.
A362881
a(n) is the length of the longest arithmetic progression ending at a(n-1); a(1)=1.
Original entry on oeis.org
1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 3, 2, 3, 2, 3, 3, 3, 4, 3, 5, 4, 3, 4, 3, 3, 5, 3, 3, 6, 3, 3, 7, 4, 3, 8, 5, 3, 9, 6, 4, 3, 3, 3, 7, 3, 3, 4, 3, 4, 3, 4, 3, 6, 3, 5, 3, 6, 2, 3, 4, 3, 7, 3, 5, 3, 4, 3, 5, 3, 6, 4, 3, 4, 3, 6, 3, 6, 4, 3, 5, 3, 5, 3, 4, 3
Offset: 1
For n = 13, the longest arithmetic progression ending at a(12) is {a(4), a(8), a(12)} = {2, 3, 4}, which has length 3, so a(13) = 3.
For n = 28, the longest arithmetic progression ending at a(27) is {a(15), a(18), a(21), a(24), a(27)} = {3, 3, 3, 3, 3}, which has length 5, so a(28) = 5.
-
See Links section.
-
a[nmax_Integer] := Module[{K, r, f, d}, K = ConstantArray[0, nmax]; K[[1 ;; 2]] = {1, 1}; For[n = 3, n <= nmax, n++, r = 1; For[b = 1, b <= n - 2, b++, d = K[[n - 1 - b]] - K[[n - 1]]; f = 2; While[n - 1 - f*b > 0 && K[[n - 1 - f*b]] - K[[n - 1 - (f - 1)*b]] == d, f = f + 1;]; If[f > r, r = f];]; K[[n]] = r;]; K]; a[87] (* Robert P. P. McKone, Aug 24 2023 *)
A362909
a(n) is the smallest number k such that A362881(k) = n.
Original entry on oeis.org
1, 3, 6, 10, 22, 31, 34, 37, 40, 121, 1035, 1078, 1121, 7607, 9453, 13667, 13729, 50040, 50123, 50206, 615964, 616448, 616932, 617416, 2828280, 2851232, 2874184, 2897136, 5350614, 5583250, 5594326, 17310256, 17312210, 17994974, 18008820, 19051432, 19069162
Offset: 1
-
/* See links */
-
See Links section.
Comments