login
Largest multiple of n in n + (n-1) +(n-2) + ... (n-k).
1

%I #9 May 19 2015 20:44:38

%S 1,2,6,4,15,18,28,8,45,40,66,72,91,84,120,16,153,126,190,200,231,198,

%T 276,264,325,260,378,196,435,450,496,32,561,442,630,288,703,570,780,

%U 520,861,882,946,924,1035,828,1128,1056,1225,950,1326,1300,1431,1134,1540

%N Largest multiple of n in n + (n-1) +(n-2) + ... (n-k).

%H Ivan Neretin, <a href="/A110346/b110346.txt">Table of n, a(n) for n = 1..10000</a>

%F a(2n-1) = n(2n-1).

%F a(2^n) = 2^n. - _Ivan Neretin_, May 17 2015

%F a(n) = n*k + n - (k^2+k)/2 where k is the greatest integer <= n with k*(k+1) divisible by 2*n. k = n iff n is odd. - _Robert Israel_, May 17 2015

%p F:= proc(n) local k, R;

%p k:= max(map(t -> `if`(t[1]<= n, t[1],NULL), Roots(k*(k+1)) mod (2*n)));

%p n*k + n - (k^2+k)/2;

%p end proc:

%p map(F, [$1..100]); # _Robert Israel_, May 17 2015

%t Table[Max[Select[n (n + 1)/2 - # (# - 1)/2 & /@ Range[n], Divisible[#, n] &]], {n, 55}] (* _Ivan Neretin_, May 17 2015 *)

%o ;;PLT DrScheme (Zucker)

%o (define (A110346 n)

%o (apply max (filter (lambda (x) (= 0 (remainder x n)))

%o (build-list n (lambda (k) (apply + (build-list (add1 k) (lambda (j) (- n j)))))))))

%o ;;yes, it would be faster to use n(n+1)/2 - k(k+1)/2 instead of summing.

%K easy,nonn

%O 1,2

%A _Amarnath Murthy_, Jul 20 2005

%E More terms from _Joshua Zucker_, May 09 2006