login
Numbers k such that the k-th and (k+1)st triangular numbers have the same number of divisors.
5

%I #35 Sep 08 2022 08:46:17

%S 3,4,5,11,17,28,29,33,41,42,52,55,59,66,68,71,76,85,88,91,93,101,107,

%T 114,123,137,141,143,149,150,159,170,172,179,183,185,186,188,191,196,

%U 197,201,203,208,213,215,217,219,227,232,235,236,239,243,244,247,265

%N Numbers k such that the k-th and (k+1)st triangular numbers have the same number of divisors.

%C The k-th triangular number T(k) = k*(k+1)/2.

%C The lesser member of each twin-prime pair appears in this sequence. Hence, A001359 is a subset of this sequence.

%H Harvey P. Dale, <a href="/A276542/b276542.txt">Table of n, a(n) for n = 1..1000</a>

%e a(3) = 5; T(5) = 5*(5+1)/2 = 15; T(5+1) = 6*(6+1)/2 = 21; 15 and 21 have 4 divisors each.

%e a(6) = 28; T(28) = 28*(28+1)/2 = 406; T(28+1) = 29*(29+1)/2 = 435; 406 and 435 have 8 divisors each

%p T:= seq(numtheory:-tau(n*(n+1)/2), n=1..1000):

%p select(t -> T[t]=T[t+1], [$1..999]); # _Robert Israel_, Apr 09 2017

%t Select[Range[1000], DivisorSigma[0, #*(# + 1)/2] == DivisorSigma[0, (# + 1)*(# + 1 + 1)/2] &]

%t SequencePosition[DivisorSigma[0,#]&/@Accumulate[Range[300]],{x_,x_}][[All, 1]] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, May 02 2018 *)

%o (PARI) k=[]; for(n=1, 1000, a=numdiv(n*(n+1)/2); b=numdiv((n+1)*(n+1+1)/2); if(a==b, k=concat(k, n))); k

%o (GAP) T:=List([1..270],n->n*(n+1)/2);; a:=Filtered([1..Length(T)-1],i->Tau(T[i])=Tau(T[i+1])); # _Muniru A Asiru_, Dec 06 2018

%o (Magma) [n: n in [1..300] | DivisorSigma(0, n*(n + 1) div 2) eq DivisorSigma(0, (n + 1)*(n + 1 + 1) div 2)]; // _Vincenzo Librandi_, Dec 06 2018

%o (Python)

%o from sympy import divisor_count

%o for n in range(1,20):

%o if divisor_count(n*(n+1)/2)==divisor_count((n+1)*(n+2)/2):

%o print(n, end=', ') # _Stefano Spezia_, Dec 06 2018

%Y Cf. A000040, A000217, A001359, A062832.

%Y Cf. A319035 (the corresponding triangular numbers).

%K nonn

%O 1,1

%A _K. D. Bajpai_, Apr 09 2017