login
A095202
Value of largest k such that (n-1) + (n-2) + (n-3) + ... + (n-k) is a multiple of n, or 0 if no such k exists.
2
0, 0, 2, 0, 4, 3, 6, 0, 8, 4, 10, 8, 12, 7, 14, 0, 16, 8, 18, 15, 20, 11, 22, 15, 24, 12, 26, 7, 28, 24, 30, 0, 32, 16, 34, 8, 36, 19, 38, 15, 40, 35, 42, 32, 44, 23, 46, 32, 48, 24, 50, 39, 52, 27, 54, 48, 56, 28, 58, 39, 60, 31, 62, 0, 64, 44, 66, 16, 68, 55, 70, 63, 72, 36, 74, 56
OFFSET
1,3
COMMENTS
Equivalently, largest k < n such that k-th triangular number (A000217(k)) is a multiple of n, or 0 if no such k exists.
FORMULA
a(2n-1) = 2n-2 for all n >= 1; a(2^n) = 0 for all n >= 1.
PROG
(PARI) {a(n) = s=0; saved_k=0; k=0; while(k<n-1, k++; s=s+(n-k); if(s%n==0, saved_k=k)); saved_k}
CROSSREFS
Cf. A000217 (triangular numbers).
Sequence in context: A140254 A340187 A204187 * A343923 A291937 A243488
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Jun 05 2004
EXTENSIONS
Edited by Rick L. Shepherd, Jun 08 2004
STATUS
approved