Given A and B, calculate A xroot B without using any root symbols or exponent symbols.
A and B are integers, but bonus points if you can make it work with noninteger indexes and radicands.
Date: 27 Sep 2015 03:28
Number of posts: 9
RSS: New posts
What counts as a root or exponent symbol? Does e^(? Will A and B be less than 10^12 (since that's the "integer" range for TI-BASIC)?
I think I have 20 bytes.
No, e^( counts as an exponent, as does 10^( and the little E under (2nd)(,). Log( and ln( also count as roots.
What is your 20-byte solution, by the way? The algorithm should be able to calculate up to A=100 and B=1e12.
How is log( a root? If you wish to exclude logarithms, please specify so.
My solution was
Prompt A,B solve(ln(B)-Aln(X),X,1→X
which is untested and may not work.
I haven't golfed a solution without log( yet.
How much precision is required? What if the solution only gives, say, 10 sigfigs?
My best attempt is 42 bytes, by the way, not counting the program header and Prompt A,B, returning the ans in X and Ans.
I was not specific enough. You may use loops, but the only operators allowed are +,-,*,/,(,). However, I am curious to see how much shorter you can get it using logarithms. So, that would be the second part of the challenge.
(1) Find A xroot B using only +,-,*,/,().
(2) Optimize it using logarithms, if possible.
Does this follow the rules?
Prompt A,B solve(B-prod(X+0rand(A)),X,1→X
Please edit your first post rather than adding information in a new post.
My solution was (given a precision factor in C):
B -> X:For(Z,0,C:For(Y,3,A:AnsX:End:X+(B/Ans-X)/A -> X:End:X
I don't normally use the solve( function.