%I #39 Jun 02 2021 14:04:01
%S 1,2,6,5,30,27,126,50,146,186,712,90,8190,2666,3472,6425,131070,37449,
%T 524286,95325,547624,700074,2677214,184365,540299,11180714,12870192,
%U 8956040,66682968,349866,2147483646,210570380,407645720,2863377066,483939976,509033160,56701272284,45812722346
%N Smallest m > 0 such that the triangular number m*(m+1)/2 is divisible by 2^n-1.
%C a(n) = A011772(2^n-1).
%C For n >= 2, a(n) <= 2^n-2, with equality if 2^n-1 is a prime (Cf. A000043).
%H Michael S. Branicky, <a href="/A343995/b343995.txt">Table of n, a(n) for n = 1..419</a> (terms 1..253 from David A. Corneth)
%e a(6) = 27 as the triangular number 27*(27 + 1)/2 = 378 is divisible by 2^6-1 = 63. - _David A. Corneth_, May 30 2021
%t Table[Min[Most[m /. Solve[{(m*(m + 1)) == c*(2^(n + 1) - 2), c > 0, m > 0}, Integers] /. C[1] -> 0]], {n, 1, 50}] (* _Vaclav Kotesovec_, May 30 2021 *)
%o (PARI) a(n) = { my(d = divisors((2^n-1)*2)); res = oo; for(i = 1, (#d + 1)\2, if(gcd(d[i], d[#d + 1 - i])==1, c = lift(chinese(Mod(-1, d[i]), Mod(0, d[#d + 1 - i]))); process(c); c = lift(chinese(Mod(0, d[i]), Mod(-1, d[#d + 1 - i]))); process(c))); res}
%o process(c) = { if(c < res, if(c > 0, res = c))} \\ _David A. Corneth_, May 30 2021
%o (Python)
%o from sympy.ntheory.modular import crt
%o from sympy import factorint
%o from itertools import product
%o def A343995(n):
%o plist = [p**q for p, q in factorint(2*(2**n-1)).items()]
%o return min(k for k in (crt(plist,d)[0] for d in product([0,-1],repeat=len(plist))) if k > 0) # _Chai Wah Wu_, May 30 2021
%Y Cf. A000043, A000217, A011772.
%K nonn
%O 1,2
%A _N. J. A. Sloane_, May 30 2021
|