

A175778


Length of the longest positive arithmetic progression, with nonzero common difference, that sums to n.


0



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, 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, 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
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,3


COMMENTS

If n is an odd prime then a(n)=2.
It appears that if n is at least 10 and twice a prime, then a(n)=4.
If n is the triangular number k*(k+1)/2 (A000217), then a(n)=k.
As a followup 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


LINKS

Table of n, a(n) for n=1..99.


EXAMPLE

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.
As a triangle, sequence starts:
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, 7, 8;
2, 4, 6, 5, 2, 7, 2, 8, 9;
4, 2, 6, 7, 5, 6, 8, 2, 9, 10;


PROG

(PARI) isokap(sumap, nbap) = {for (d=1, sumap, fap = (sumap  (nbap1)*nbap*d/2)/nbap; if (fap <= 0, return (0)); if (type(fap) == "t_INT", return (1)); ); return (0); }
a(n) = {if (n == 1, return (1)); forstep(len=n1, 1, 1, if (isokap(n, len), return (len)); ); } \\ Michel Marcus, Jul 13 2014


CROSSREFS

Sequence in context: A104011 A242879 A176775 * A226182 A099774 A305973
Adjacent sequences: A175775 A175776 A175777 * A175779 A175780 A175781


KEYWORD

nonn


AUTHOR

John W. Layman, Sep 03 2010


STATUS

approved



