[go: up one dir, main page]

login
Where n appears in A370952, or -1 if n never appears there.
3

%I #22 Apr 20 2024 03:02:41

%S 1,4,49,2,8,24,47,22,3,20,5,18,44,16,175,14,42,12,173,10,40,6,171,88,

%T 38,335,169,86,36,333,167,84,34,331,7,82,32,329,9,80,11,327,13,78,15,

%U 325,17,76,19,323,21,74,23,321,25,72,160,319,7468,70,158,317,25099

%N Where n appears in A370952, or -1 if n never appears there.

%H Chai Wah Wu, <a href="/A372052/b372052.txt">Table of n, a(n) for n = 1..10000</a>

%o (Python)

%o from itertools import count

%o def A372052(n):

%o a, aset = 1, {0,1}

%o for p in count(3,2):

%o if a == n:

%o return p>>1

%o for b in count(a%p,p):

%o if b not in aset:

%o aset.add(b)

%o a = b

%o break # _Chai Wah Wu_, Apr 17 2024

%o (Python) # faster for initial segment of sequence

%o def A372052_gen(): # uses A370952_gen/imports from _Chai Wah Wu_ in A370952

%o adict, n = dict(), 1

%o for i, v in enumerate(A370952_gen(), 1):

%o if v >= n and v not in adict:

%o adict[v] = i

%o while n in adict:

%o yield adict[n]; del adict[n]; n += 1

%o print(list(islice(A372052_gen(), 63))) # _Michael S. Branicky_, Apr 18 2024

%Y Cf. A370952, A370975.

%K nonn

%O 1,2

%A _N. J. A. Sloane_, Apr 17 2024

%E More terms from _Chai Wah Wu_, Apr 17 2024