Lost in mathematics

How does one go about calculating a factor (!) with blocks...? I don't see a way. I am not strong in maths, so I need some help. Thanks

Do you mean a factorial, e.g. 4x3x2x1 ?

Or do you want the decomposition into a product of prime numbers?


Factorial(n) =
  If n <= 1 then 1
    Else n * factorial (n-1)

Use the value if/then block .

there is no factorial block, is there?

yes. Calculating possible combinations of a password

You may enjoy this:

I understand factorial, but there is factorial block. I did manage to figure it with a simple recursive loop though.


It would be easier to write "n!"

You were not clear, unless this is an across the pond language thing...

i mean a factorial (!). like in your first query; 4x3x2x1 written as 4!

Does AI2 have a limitation to its calculations? I cannot get it to reproduce a digit longer than 18 characters, numerically speaking, even without anything done to it. It starts to swap the end digits out for zeros.

That's not supposed to happen for exact math.

See if it happens going into the label, or out of the number block.

Your number should be a multiple of 1234567890
By
10^10 + 1
or so

I disapprove of rewriting inputs to a function

Use a local variable, to avoid side effects.

How do i test that?

This is recursion, which is a function calling itself.


All you had was a loop.


From this test, the accuracy was lost on the way from the keyboard (text) into the blue number block.

But the text block keeps the accuracy.

I did not expect this.

So I should be feeding the (soon to be edited) factorial procedure a text number to maintain integrity?
My factorial procedure did the same, just not with the same method

Only if you have really long constant numbers.

But I don't know of any field of science or math that uses 18 digit numbers with full precision, except maybe Number Theory.

i'm playing around combinations of potential passwords using predefined characters. I have come up with (maybe,unless I have gone awry) combinations of numbers with well over 35,000 digits. (Not to be confused with 35,000 potential combinations) My confusion comes from where the combination nPr calculations start.
for example, if I randomly select 44 characters from a list of 88 (in theory, for now, all the possible characters on a standard keyboard available to create a password from), and then randomly select 14 from the selected 44 to make a password. Is it necessary to include the randomly selected 44 characters in the calculation to define potential combinations of passwords? Or am I still having to consider nP88 given that that's all the characters available?

https://www.google.com/search?q=introduction+to+combinatorics

Have fun!

P.S.

When dealing with large numbers, the practical approach is to worry only about the scale of the numbers, like in scientific notation .

Only Number Theorists or people with Obsessive Compulsive Disorder (OCD) worry about every last digit.

I am not worried about that level of details. I am having trouble with the basics more so. Thanks for the link though. I will dive deep into that world of maths for fun. :nerd_face: