A118387 Record values in A079300 (number of shortest addition chains of n).
1, 2, 5, 15, 33, 40, 132, 220, 352, 1258, 2661, 3903, 9787, 12989, 17961, 31373, 33076, 55262, 110624
Offset: 1
References
- See A118386 for references.
This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
For n < 149 and for many higher values of n, a(n) is the depth of n in a tree whose first 6 levels are shown below. The path from the root of the tree to n gives an optimal addition chain. (See Knuth, Vol. 2, Sect. 4.6.3, Fig. 14 and Ex. 5.) 1 | 2 / \ / \ / \ / \ / \ 3 4 / \ \ / \ \ / \ \ / \ \ 5 6 8 / \ | / \ / \ | / \ 7 10 12 9 16 / / \ / \ / \ / \ 14 11 20 15 24 13 17 18 32 E.g., a(15) = 5 and an optimal chain for 15 is 1, 2, 3, 6, 12, 15. It is not possible to extend the tree to include the optimal addition chains for all n. For example, the chains for 43, 77, and 149 are incompatible. See the link to Achim Flammenkamp's web page on addition chains.
All five of the shortest addition chains for 7 are Brauer chains: (1,2,3,4,7), (1,2,3,5,7), (1,2,3,6,7), (1,2,4,5,7), (1,2,4,6,7). Hence a(7) = 5. 13 has ten shortest addition chains: (1,2,3,5,8,13), (1,2,3,5,10,13), (1,2,3,6,7,13), (1,2,3,6,12,13), (1,2,4,5,9,13), (1,2,4,6,7,13), (1,2,4,6,12,13), (1,2,4,8,9,13), (1,2,4,8,12,13), and (1,2,4,5,8,13). Of these, all but the last are Brauer chains. Hence a(13) = 9. 12509 has 28 shortest addition chains, none of which are Brauer chains. Hence a(12509) = 0.
7 has five shortest addition chains: (1,2,3,4,7), (1,2,3,5,7), (1,2,3,6,7), (1,2,4,5,7), and (1,2,4,6,7). All of these are Brauer chains. Hence a(7) = 0. 13 has ten shortest addition chains: (1,2,3,5,8,13), (1,2,3,5,10,13), (1,2,3,6,7,13), (1,2,3,6,12,13), (1,2,4,5,9,13), (1,2,4,6,7,13), (1,2,4,6,12,13), (1,2,4,8,9,13), (1,2,4,8,12,13), and (1,2,4,5,8,13). Of these, only the last is non-Brauer. Hence a(13) = 1. 12509 has 28 shortest addition chains, all of which happen to be non-Brauer (in fact, it is the smallest natural number for which all shortest addition chains are non-Brauer). Hence a(12509) = A079300(12509) = 28.
The smallest chain for 5 is 2, 3, 5 with sum a(2) = 2+3+5 = 10. The smallest chain for 7 is 2, 3, 4, 7 with sum a(3) = 2+3+4+7 = 16.
step(V)=my(U=List(),v); for(i=1,#V, v=V[i]; for(i=1,#v, for(j=i,#v, if(v[i]+v[j]>v[#v], listput(U, concat(v, v[i]+v[j])))))); vecsort(Vec(U),,8) sm(v)=sum(i=2,#v,v[i]) a(n)=if(n<2,return(5*n)); n=2*n+1; my(V=[[1,2]],U,t); while(#(U=select(v->v[#v]==n,V))==0, V=select(v->v[#v]<=n,step(V))); t=vecmin(apply(sm,U)); while(#V, V=step(select(v->sm(v)Charles R Greathouse IV, Jul 17 2013
For n=7, we can evaluate x^7 using only 4 multiplications in 6 ways: x^2 = x * x ; x^3 = x * x^2 ; x^4 = x * x^3 ; x^7 = x^3 * x^4 x^2 = x * x ; x^3 = x * x^2 ; x^4 = x^2 * x^2 ; x^7 = x^3 * x^4 x^2 = x * x ; x^3 = x * x^2 ; x^5 = x^2 * x^3 ; x^7 = x^2 * x^5 x^2 = x * x ; x^3 = x * x^2 ; x^6 = x^3 * x^3 ; x^7 = x * x^6 x^2 = x * x ; x^4 = x^2 * x^2 ; x^5 = x * x^4 ; x^7 = x^2 * x^5 x^2 = x * x ; x^4 = x^2 * x^2 ; x^6 = x^2 * x^4 ; x^7 = x * x^6
a(23)=5 because 23=1+1+2+1+4+9+5 is the shortest addition chain for 23. For n=9 there are A079301(9)=3 different shortest addition chains, all of Brauer type: [1 2 3 6 9] -> 9=1+1+1+3+3 -> 2 different addends {1,3} [1 2 4 5 9] -> 9=1+1+2+1+4 -> 3 different addends {1,2,4} [1 2 4 8 9] -> 9=1+1+2+4+1 -> 3 different addends {1,2,4} The minimum number of different addends is 2, therefore a(9)=2.
Comments