login
A130335
Smallest k > 0 such that gcd(n*(n+1)/2, (n+k)*(n+k+1)/2) = 1.
4
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, 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, 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
OFFSET
1,2
COMMENTS
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
LINKS
FORMULA
a(n) = Min{k>0: A050873(A000217(n+k),A000217(n))=1);
a(n) = A130334(n) - n;
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.
a(n) == 1 (mod 3) if a(n) != 2. - Robert G. Wilson v, Jun 03 2007
MATHEMATICA
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 *)
PROG
(Python)
from math import gcd
def A130335(n):
k, Tn, Tm = 1, n*(n+1)//2, (n+1)*(n+2)//2
while gcd(Tn, Tm) != 1:
k += 1
Tm += k+n
return k # Chai Wah Wu, Sep 16 2021
(PARI) a(n) = my(k=1); while (gcd(n*(n+1)/2, (n+k)*(n+k+1)/2) != 1, k++); k;
CROSSREFS
Cf. A130334.
See A130336 and A130337 for record values and where they occur.
Sequence in context: A082072 A082066 A179931 * A347236 A073246 A021790
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, May 28 2007
STATUS
approved