%I #25 Jan 14 2022 07:41:58
%S 2,3,8,15,63,120,440,945,2079,4095,21735,98175,133056,395199,338625,
%T 1890945,3501576,8390304,35820225,126775935,149848335,879207616,
%U 302464800
%N Smallest k such that A349949(k) = n, or -1 if no such k exists.
%C a(25) = 879207615. - _Chai Wah Wu_, Jan 13 2022
%o (PARI) f(n) = my(sd=setunion(divisors(n-1), divisors(n+1))); sumdiv(n, d, (vecsearch(sd, d-1)>0) || (vecsearch(sd, d+1)>0)); \\ A349949
%o a(n) = my(k=2); while (f(k) != n, k++); k; \\ _Michel Marcus_, Jan 10 2022
%o (Python)
%o from itertools import count
%o from sympy import divisors
%o def A350654(n):
%o for m in count(2):
%o c = 0
%o for d in divisors(m,generator=True):
%o if not (((m-1) % (d-1) if d > 1 else True) and (m-1) % (d+1) and ((m+1) % (d-1) if d > 1 else True) and (m+1) % (d+1)):
%o c += 1
%o if c > n:
%o break
%o if c == n:
%o return m # _Chai Wah Wu_, Jan 12 2022
%Y Cf, A000005, A349949.
%K nonn,more
%O 1,1
%A _Tejo Vrush_, Jan 09 2022
%E a(11)-a(19) from _Jinyuan Wang_, Jan 10 2022
%E Escape clause value changed to -1 by _N. J. A. Sloane_, Jan 12 2022
%E a(20)-a(21) from _Chai Wah Wu_, Jan 12 2022
%E a(22)-a(23) from _Chai Wah Wu_, Jan 13 2022