login
a(0) = 21; for n > 0, a(n) is the smallest triangular number which is a (proper) multiple of a(n-1).
3

%I #22 May 06 2024 12:04:59

%S 21,105,210,630,25200,32004000,508031496000,128015872500032496000,

%T 3670698694547655407496988066168944000,

%U 10302657959650317880463349610273001290502485245258650172717840000

%N a(0) = 21; for n > 0, a(n) is the smallest triangular number which is a (proper) multiple of a(n-1).

%H Chai Wah Wu, <a href="/A068142/b068142.txt">Table of n, a(n) for n = 0..11</a>

%e a(1) = 105, since 105 = 5*21 = 5*a(0), 105 is a triangular number and 2*a(0) = 42, 3*a(0) = 63, 4*a(0) = 84 are not triangular numbers.

%t pm1[{k_}] := {1, k-1}; pm1[lst_] := Module[{a, m, v}, a=lst[[1]]; m=Times@@Rest[lst]; v=pm1[Rest[lst]]; Union[ChineseRemainder[{1, #}, {a, m}]&/@v, ChineseRemainder[{-1, #}, {a, m}]&/@v]]; nexttri[1]=3; nexttri[n_] := Module[{s}, s=(pm1[Power@@#&/@FactorInteger[4n]]^2-1)/8; For[i=1, True, i++, If[s[[i]]>n, Return[s[[i]]]]]]; a[0]=21; a[n_] := a[n]=nexttri[a[n-1]]; (* First do <<NumberTheory`NumberTheoryFunctions`. If lst is a list of relatively prime integers >= 3, pm1[lst] is the list of numbers less than their product and == 1 or -1 (mod every element of lst). nexttri[n] is the smallest triangular number >n and divisible by n. *)

%o (PARI) {a068142(m)=local(k,q,n); k=6; q=k*(k+1)/2; while(q<m,n=q; print1(n,","); k++; q=q+k; while(q<m&&q%n>0,k++; q=q+k))}

%o (Python)

%o from itertools import islice

%o from sympy import sqrt_mod_iter

%o def A068142_gen(): # generator of terms

%o a = 168

%o while True:

%o yield a>>3

%o b = a+1

%o for d in sqrt_mod_iter(1,a):

%o if d==1 or d**2-1 == a:

%o d += a

%o if d&1 and d < b:

%o b = d

%o a = b**2-1

%o A068142_list = list(islice(A068142_gen(),12)) # _Chai Wah Wu_, May 05 2024

%Y Cf. A000217, A068776.

%K nonn

%O 0,1

%A _Amarnath Murthy_, Feb 22 2002

%E Edited and extended by _Klaus Brockhaus_, _Robert G. Wilson v_, Mar 01 2002 and _Dean Hickerson_, Mar 09 2002