|
| |
|
|
A197702
|
|
Smallest positive integer k such that n = +-1 +-3 +-... +-(2k-1) for some choice of +'s and -'s
|
|
1
|
|
|
|
1, 2, 3, 2, 5, 4, 3, 4, 3, 4, 5, 6, 5, 4, 5, 4, 5, 6, 5, 6, 7, 6, 5, 6, 5, 6, 7, 6, 7, 6, 7, 8, 7, 6, 7, 6, 7, 8, 7, 8, 7, 8, 7, 8, 9, 8, 7, 8, 7, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 10, 9, 8, 9, 8, 9, 10, 9, 10, 9, 10, 9, 10, 9, 10, 9, 10, 11, 10, 9, 10, 9, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 12, 11, 10, 11, 10
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
|
OFFSET
|
1,2
|
|
|
COMMENTS
|
Conjecture. Let SO(k) be the sum of the first k odd positive integers. Then a(n)=k if n=SO(k). Otherwise, choose k so that SO(k-1)<n<SO(k). Then if SO(k)-n=4, a(n)=k+2, else if SO(k)-n is odd then a(n)=k+1 else a(n)=k. (This has been verified for n up to 200.)
|
|
|
LINKS
|
Alois P. Heinz, Table of n, a(n) for n = 1..10000
|
|
|
EXAMPLE
|
The sum of 3 terms 1 - 3 + 5 gives 3, but none of the 2-term sums 1+3, 1-3, -1+3, -1-3 gives 3, so a(3)=3.
|
|
|
MAPLE
|
b:= proc(n, i) option remember;
(n=0 and i=0) or abs(n)<=i^2 and (b(n-2*i+1, i-1) or b(n+2*i-1, i-1))
end:
a:= proc(n) local k;
for k from floor (sqrt(n)) while not b(n, k) do od; k
end:
seq (a(n), n=1..100); # Alois P. Heinz, Oct 19 2011
|
|
|
CROSSREFS
|
Cf. A140358.
Sequence in context: A011153 A214750 A132226 * A075861 A205706 A141658
Adjacent sequences: A197699 A197700 A197701 * A197703 A197704 A197705
|
|
|
KEYWORD
|
nonn
|
|
|
AUTHOR
|
John W. Layman, Oct 18 2011
|
|
|
STATUS
|
approved
|
| |
|
|