%I #29 Jul 01 2023 11:00:08
%S 3,6,18,40,127251,198,26890623,918,17298,6640,25269208984375,3400,
%T 3900566650390623,640062,8418573,18088,1164385682220458984373,41650,
%U 69528379848480224609373,128464,34084859373,12164094,150509919493198394775390625,90270,418514293125,64505245696
%N Least number k such that k and k+2 both have exactly 2n divisors, or -1 if no such number exists.
%e For n=1, numdiv(3) = numdiv(5) = 2 = 2*1, and no number < 3 satisfies this, hence a(1) = 3.
%t a={}; n=1; nmax=10; For[k=1, n<=nmax, k++, If[DivisorSigma[0, k] == DivisorSigma[0, k+2] == 2n, AppendTo[a, k]; k=1; n++]]; a (* _Stefano Spezia_, Aug 26 2022 *)
%t Flatten[Table[SequencePosition[DivisorSigma[0,Range[27*10^6]],{2n,_,2n},1],{n,10}],1][[;;,1]] (* The program generates the first 10 terms of the sequence. To generate more, increase the Range constant but the program will take a long time to run. *) (* _Harvey P. Dale_, Jul 01 2023 *)
%o (PARI) a(n)=for(k=1,+oo,if(numdiv(k)==2*n&&numdiv(k+2)==2*n,return(k)))
%Y Numbers k such that k and k+2 both have exactly m divisors: A001359 (m=2), A356742 (m=4), A356743 (m=6), A356744 (m=8).
%Y Cf. A000005 (d(n)), A003680, A005238, A006558, A006601, A062832, A067888, A067889, A075036.
%K nonn
%O 1,1
%A _Jean-Marc Rebert_, Aug 26 2022
%E More terms from _Jinyuan Wang_, Aug 28 2022