login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Smallest k > 0 such that gcd(n*(n+1)/2, (n+k)*(n+k+1)/2) = 1.
4

%I #18 Sep 18 2021 00:58:31

%S 1,2,7,2,2,4,2,2,4,2,2,10,2,2,7,2,2,4,2,2,4,2,2,13,2,2,10,2,2,7,2,2,4,

%T 2,2,10,2,2,7,2,2,4,2,2,7,2,2,10,2,2,7,2,2,4,2,2,4,2,2,13,2,2,10,2,2,

%U 4,2,2,4,2,2,10,2,2,7,2,2,4,2,2,4,2,2,22,2,2,7,2,2,16,2,2,4,2,2,10,2,2,7,2

%N Smallest k > 0 such that gcd(n*(n+1)/2, (n+k)*(n+k+1)/2) = 1.

%C First occurrence of 3k+1, k=0.. or 0 if unknown, limit = 2^31: 1, 6, 3, 12, 24, 90, 231, 84, 792, 0, 195, 3432, 780, 0, 3255, 6075, 73644, 51482970, 0, 924, 183540, 0, 45219, 0, 509124, 3842375445, 29259, 71484, 0, 0, 0, 2311539, 238547880, 0, 55380135, 893907420, 23303784, 0, 0, 208260975, 0, 0, 1744264599, 0, 0, 0, 1487657079, 665710275, 0, 0, 1963994955, 0, 319589424, 0, 0, 0, 4181294964, 0, 0, 383229924, ..., . - _Robert G. Wilson v_, Jun 03 2007

%H Reinhard Zumkeller, <a href="/A130335/b130335.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = Min{k>0: A050873(A000217(n+k),A000217(n))=1);

%F a(n) = A130334(n) - n;

%F a(n) > 1 for n>1; a(n) > 2 iff n mod 3 = 0: a(A001651(n))=2, a(A008585(n)) > 2 for n > 1.

%F a(n) == 1 (mod 3) if a(n) != 2. - _Robert G. Wilson v_, Jun 03 2007

%t f[n_] := Block[{k = If[ n == 1 || Mod[n, 3] == 0, 1, 2]}, While[ GCD[n(n + 1)/2, (n + k)(n + k + 1)/2] != 1, k += 3 ]; k]; Array[f, 100] (* _Robert G. Wilson v_, Jun 03 2007 *)

%o (Python)

%o from math import gcd

%o def A130335(n):

%o k, Tn, Tm = 1, n*(n+1)//2, (n+1)*(n+2)//2

%o while gcd(Tn,Tm) != 1:

%o k += 1

%o Tm += k+n

%o return k # _Chai Wah Wu_, Sep 16 2021

%o (PARI) a(n) = my(k=1); while (gcd(n*(n+1)/2, (n+k)*(n+k+1)/2) != 1, k++); k;

%Y Cf. A000217, A050873.

%Y Cf. A001651, A008585.

%Y Cf. A130334.

%Y See A130336 and A130337 for record values and where they occur.

%K nonn

%O 1,2

%A _Reinhard Zumkeller_, May 28 2007