login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A258447
a(5) = 0; a(n) = 1 + min{a(k + m): n = k * m; k, m >= 0}.
1
1, 4, 3, 2, 1, 0, 1, 3, 2, 2, 4, 4, 3, 4, 3, 3, 3, 4, 3, 4, 3, 5, 5, 5, 4, 5, 4, 4, 4, 6, 5, 5, 4, 4, 5, 4, 4, 6, 5, 4, 4, 6, 5, 5, 4, 4, 6, 5, 4, 4, 4, 4, 5, 5, 4, 4, 4, 6, 6, 5, 4, 6, 5, 4, 4, 4, 5, 6, 5, 5, 5, 5, 4, 6, 5, 4, 5, 4, 5, 5, 4, 4, 6, 5, 4, 6, 5, 5, 5, 6, 5, 4, 5, 6, 5, 5, 4, 6, 5, 4, 4, 7, 6, 6, 5, 5, 5, 6, 5
OFFSET
0,2
COMMENTS
All elements occur only finitely often.
LINKS
EXAMPLE
a(5) = 0 which gives a(1 * 4) = a(2 * 3) = 1 which give a(1 * 3) = 2 and a(2 * 4) = a(3 * 3) = 2.
PROG
(PARI) /* to get all elements up to n, have the program return v instead of v[n+1]; replace "; v[n+1]}" with "; v}". */
a(n) = {my(nn = max(6, n + isprime(n)), l1=listcreate(), l2 = listcreate(), v = vector(nn + 1, i , -1)); v[1]=1; v[6]=0; q = 1; listput(l1, 5);
while(#l1>0, for(i=1, #l1, u=min(l1[i] \ 2, ((l1[i] / 2) - sqrt(max(0, (l1[i] / 2) ^2 -nn))))\1; for(j=1, u, p=(l1[i] - j) * j; if(v[p+1] == -1, listput(l2, p); v[p + 1] = q))); l1 = l2; listsort(l1, 1); l2=listcreate(); q++); v[n+1]}
CROSSREFS
Sequence in context: A100802 A022960 A023446 * A066440 A182425 A071692
KEYWORD
nonn
AUTHOR
David A. Corneth, May 30 2015
STATUS
approved