OFFSET
1,1
COMMENTS
Equivalently, a(n) is the smallest index at which there begins an n-term subsequence of A000005 that has occurred before.
EXAMPLE
Let d(j) = A000005(j) (i.e., the number of divisors of j). The sequence {d(j)} = A000005 begins as follows:
.
j: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...
d(j): 1 2 2 3 2 4 2 4 3 4 2 6 2 4 4 5 2 6 2 6 ...
.
The first value of d(j) that appears more than once is 2, which appears for the first time at j=2 and for the second time at j=3. Thus a(1) = 3.
Similarly, of all the subsequences of {d(j)} consisting of two consecutive terms, the first one to appear more than once is {2,4}, which first appears beginning at j=5 and then appears the second time beginning at j=7. Thus a(2) = 7.
Likewise, the first subsequence of {d(j)} consisting of three consecutive terms to appear a second time is {2,6,2}, which first appears beginning at j=11 and then reappears beginning at j=17, so a(3) = 17.
The first repeated 1-, 2-, and 3-term subsequences and the corresponding terms a(1), a(2), and a(3) are illustrated below.
.
a(1) a(2) a(3)
| | |
j: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
d(j): 1 2 2 3 2 4 2 4 3 4 2 6 2 4 4 5 2 6 2 6
^ ^ ^--^ ^--^ ^--^--^ ^--^--^
MATHEMATICA
nn = 25000; s = {}; k = 1; f[x_] := DivisorSigma[0, x]; Monitor[Do[AppendTo[s, f[n]]; t = SequencePosition[s[[1 ;; n - k]], s[[-k ;; -1]]]; If[Length[t] > 0, k++; a[k-1] = n - k + 2], {n, nn}], n]; TakeWhile[Array[a, k], IntegerQ] (* Michael De Vlieger, Aug 07 2023 *)
PROG
(Python)
from itertools import count
from sympy import divisor_count
def A364189(n):
b = {a:=tuple(divisor_count(i) for i in range(1, n+1)), }
for m in count(n+1):
if (a:=a[1:]+(divisor_count(m), )) in b:
return m-n+1
b.add(a) # Chai Wah Wu, Aug 07 2023
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Jon E. Schoenfield, Aug 07 2023
EXTENSIONS
a(14) from Michael De Vlieger, Aug 07 2023
a(15)-a(22) from Chai Wah Wu, Aug 07 2023
STATUS
approved