%I #15 May 20 2021 08:24:57
%S 1,1,2,2,2,3,2,2,3,4,2,3,2,4,5,4,2,4,2,5,6,4,2,4,5,4,6,7,2,5,2,4,6,4,
%T 7,8,2,4,6,5,2,7,2,8,9,4,2,6,7,5,6,8,2,9,10,7,6,4,2,8,2,4,9,8,10,11,2,
%U 8,6,7,2,9,2,4,10,8,11,12,2,8,9,4,2,8,10,4,6,11,2,12,13,8,6,4,10,8,2,7,11
%N Length of the longest positive arithmetic progression, with nonzero common difference, that sums to n.
%C If n is an odd prime then a(n)=2.
%C It appears that if n is at least 10 and twice a prime, then a(n)=4.
%C If n is the triangular number k*(k+1)/2 (A000217), then a(n)=k.
%C As a follow-up to previous comment, it appears that, if sequence is displayed as a regular triangle, then the diagonals starting at rows 1, 2, 4, 7, 11, 16, 22, ...(likely A000124) are constituted of consecutive integers. - _Michel Marcus_, Jul 13 2014
%H Antti Karttunen, <a href="/A175778/b175778.txt">Table of n, a(n) for n = 1..65537</a>
%e The arithmetic progressions {1,3,5} and {2,3,4}, of length 3, sum to 9. No longer arithmetic progression sums to 9, so a(9)=3.
%e As a triangle, sequence starts:
%e 1;
%e 1, 2;
%e 2, 2, 3;
%e 2, 2, 3, 4;
%e 2, 3, 2, 4, 5;
%e 4, 2, 4, 2, 5, 6;
%e 4, 2, 4, 5, 4, 6, 7;
%e 2, 5, 2, 4, 6, 4, 7, 8;
%e 2, 4, 6, 5, 2, 7, 2, 8, 9;
%e 4, 2, 6, 7, 5, 6, 8, 2, 9, 10;
%o (PARI) isokap(sumap, nbap) = {for (d=1, sumap, fap = (sumap - (nbap-1)*nbap*d/2)/nbap; if (fap <= 0, return (0)); if (type(fap) == "t_INT", return (1));); return (0);}
%o a(n) = {if (n == 1, return (1)); forstep(len=n-1, 1, -1, if (isokap(n, len), return (len)););} \\ _Michel Marcus_, Jul 13 2014
%K nonn,look
%O 1,3
%A _John W. Layman_, Sep 03 2010
|