"Function Products"
Given the following functions:
f(x) = 50x^3 - 46x^2 + 25x - 14
g(x) = 49x^3 + 45x^2 - 20x^3 + 195x - 4
What are the first 5 digits of f(105) * g(105)?
Note that ^ means exponent
Once you understand the math and know how your language uses large numbers just work through this step by step.
Awnser:
f(105) = 57881250 - 507150 + 2625 - 14
g(105) = 56723625 + 496125 - 23152500 + 20475 - 4
f(105) = 57376711
g(105) = 34087721
f(105) * g(105) = 1955841316465631
First 5 digits = 19558
g(105) = 56723625 + 496125 - 23152500 + 20475 - 4
f(105) = 57376711
g(105) = 34087721
f(105) * g(105) = 1955841316465631
First 5 digits = 19558
Source:
function solution(){ $no1 = bcmul( 50, bcpow(105, 3)); $no1_2 = bcmul( 46, bcpow(105, 2)); $no1_3 = bcmul(25, 105); echo "f(105) = ".$no1." - ".$no1_2." + ".$no1_3." - 14
"; $no2 = bcmul( 49, bcpow(105, 3)); $no2_2 = bcmul( 45, bcpow(105, 2)); $no2_3 = bcmul( 20, bcpow(105, 3)); $no2_4 = bcmul(195, 105); echo "g(105) = ".$no2." + ".$no2_2." - ".$no2_3." + ".$no2_4." - 4
"; $f = bcsub(bcadd(bcsub($no1 , $no1_2), $no1_3), 14); echo "f(105) = ".$f."
"; $g = bcsub(bcadd(bcsub(bcadd($no2, $no2_2), $no2_3), $no2_4), 4); echo "g(105) = ".$g."
"; $result = bcmul($f, $g); echo "f(105) * g(105) = ".$result."
"; echo "First 5 digits = ".substr($result, 0, 5).""; }