Please help for easy method to solve longish multiplications and division equation.
Example like (667 x 6 x 74) / (384 x 384)
Many Thanks in advance
you can try to break it down and multiply divisions.
also it might be even better if you would sort the numbers in each group and pair the biggest of each group.
For example:
instead of (667 * 6 * 74)/(384 * 384)
you can do 667/384 * 74/384 * 6.
instead of (5 * 234 * 98 * 3433) / (2 * 34 * 7 * 333)
you can do 3433/333 * 234/34 * 98/7 * 5/2.
Related
No matter how much I think about this, I cannot get the answer... The rules are fairly simple:
using only lowercase letters, from the English alphabet (no numbers or special characters allowed) tell me how many passwords of five characters can be created if there MUST be three or more vocals in the actual password.
I believe the right approach is to calculate the total amount of passwords you can create with five digits and then subtract from it those that do not fulfill the vocal requirements. Yet I have hit this mindblock and cannot seem to figure out how many passwords I need to discard.
If you could lend me a hand it would be much appreciated!
If I understood well your problem:
We count the total passwords: one letter for each position 26 * 26 * 26 * 26 * 26 = 265
Then, we calculate how many passwords we can create with three vowels: 5C3 * 53 * 212 (the vowels can be in 3 out of 5 positions, the rest will be 21 consonants to choose in the two remaining positions)
Now we calculate how many passwords we can create with four wovels: 5C4 * 54 * 21 (similar explanation as above)
We can as well have 5 vowels, don't we? So 5^5 (similar to the first point)
We then subtract all these to the total, so:
265 - 5C3 * 53 * 212 - 5C4 * 54 * 21 - 55
Edit right before going to bed: in this was we count the numbers of passwords which do not respect our standard of having at least three vowels. Since we want that, we just sum all the combinations without subtracting from the total.
I have a clue, why the expansion method of any value of say an x base always converts in decimal base. For example,
why if 2345 base 9 when apply the expansion method will always come to a value of base 10. Similar if we take 6577 base 8 (octal) applying expansion method i.e (6 * 8^3)+(5 * 8^2)+ (7 * 8^1)+(7 * 8^0) will systematically result to 3455 to base 10 !!! My question is why base 10 and not for example base 16....why is it systematically a decimal when using the expansion method of any base????
You are mixing number itself and its representation for human's convenience.
We usually use decimal system as traditional one for representation of numbers as strings (literals). But number value is the same in any system
01111(bin) = 15(dec) = F(hex) = 17(oct) = 100010 (fibonacci) and so on
why is it systematically a decimal when using the expansion method of any base????
I'm gonna flip this qustion for you: Why do YOU systematically keep using decimal?
You claim that 6 * 8^3 = 3072, I claim that 6 * 8^3 = C00. In fact I also claim that 6 * 8^3 = 4183. Why not 11 * 13^3 = 44242? Or 20 * 22^10 = 11012210? They're all correct.
You and only you chose to interpret the digits and perform arithmetic base 10.
I am trying to illustrate the expression: ( 3 * 4 + 5 * 6 + 7 ) using an abstract syntax tree. I have already illustrated the expression: ( 3 * (4 + 5) * (6 + 7) ).
Could someone please illustrate the expression without parenthesis with order of left-most first. Thanks in advance.
EDIT:
Here is an updated image of what I think may be correct, but please correct me if it is not. Thanks.
To make it simple:
fg=c(1,8,3,6,4,8,7,9)
I would like to know how much values bigger than 7 are there in fg represented as a percentage.
sum(fg>7) / length(fg) * 100
Try this:
> 100 * mean(fg > 7)
[1] 37.5
I'm trying to convert a (small) numerator and denominator to a numerator in terms of a large constant denominator, chosen to be divisible by most small numbers and to be just under 2**63. Since that's likely to overflow, I'll use pragma Overflow_Mode (Eliminated) (cf. the GNAT 4.8 manual http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gnat_ugn_unw/Specifying-the-Desired-Mode.html#Specifying-the-Desired-Mode).
with Ada.Command_Line;
with Ada.Text_IO;
procedure Example is
pragma Overflow_Mode (Eliminated);
Large_Composite : constant := (2 ** 7) * (3 ** 5) * (5 ** 2) * 7
* 11 * 13 * 17 * 19 * 23 * 29 * 31 * 37 * 41;
type Word_Unsigned is mod 2**64;
N, D : Integer;
begin
N := Integer'Value (Ada.Command_Line.Argument (1));
D := Integer'Value (Ada.Command_Line.Argument (2));
Ada.Text_IO.Put (Word_Unsigned ((N * Large_Composite) / D)'Img);
end Example;
Unfortunately, when trying to compile the example code (and the real code it's a distillation of) with "~/bin/gcc-4.8.0/bin/gnatmake -gnat12 -gnata -Wall example.adb" (and with -gnato3, though that should be redundant to the pragma), the compiler says:
example.adb:12:46: value not in range of type "Standard.Integer"
example.adb:12:46: static expression fails Constraint_Check
gnatmake: "example.adb" compilation error
Hrumph. Am I not understanding what Overflow_Mode does? Is there some easy way to rearrange this so it works? (I can go to plan A, a more normal fraction class that may or may not be faster or plan B, just using floats and accepting that 1/3 will get rounded, but I'd like this to work. Proper infinite-length integer support is overkill here.)
It's not a complete answer, but using Long_Long_Integer, which is large enough to hold Large_Composite, instead of Integer suppresses the warnings, and pragma Overflow_Mode does its job and lets me use stuff like N = 99 and D = 100 and get the right answer. This computational model still seems somewhat inconsistent, but at least the code is working.