Custom common factor block

What’s the best way to make a custom block that finds the common factor between multiple numbers? I couldn’t find an existing block for this.

you may be able to go number to number from the range in between the min and max of the list.

most likely isn’t the best or most efficient way to find it but i thought i may as well add an idea

Edited to add something I threw together

Main Project recovering  script pic (1)

no idea if this idea works at all so I’m still messing around with it, but which ever one gives (0,0,0) on the end list may be the GCF

Is this for a for a project your currently working on? Just want to know so I can see if I can help.

its a little chemistry project to easier calculate masses and stuff like that, right now Im making this common factor thing so I can show the empirical factor if there is one (Empirical factor is what the smallest number of the molecule could be eg: H6 O9, The Empirical formula would be H2 O3)

Okay! Just wanted to know. I’m working on a custom block right now, that should work with most numbers. Although I am testing it and developing it before I release it.

happy to help!

This should work.

Here’s the result

Custom Blocks script pic 5

Oh dear, I noticed a grammar error AFTER sending you the result. Just swap “Of and 16”

Custom Blocks script pic 7

This is “Greatest” common factor, and not just common factor or common factors. So if you need something changed I can try doing that.

why is it a boolean?

I don’t see a Boolean, can you explain a bit more? @coder_07

the shape of the block

That’s an operator/predicate Are you thinking of the T/F (Boolean)block?

Reporters are used for math and are shaped like predicates so they can be added in “if” blocks or C blocks, that’s why it’s shaped the way it is. here’s the operators for a visual:

yeah but the <> shape is usually for blocks that report booleans

Oh sorry. It’s shaped so it can be used in (if) or (=,>,<) blocks. Like other mathematical blocks. Sorry for the mixup! But then again it can always be changed to a reporter. @coder_07

I’m a bit confused, It looks like you used the custom block within its own coding?

Yes, it repeats itself and continues till it gets the answer, just drag the block from within itself to the script. That’s what the “if,else” block is there for.

ah, I see, I appreciate the help! I am wondering, do you think it would be possible to make one that could process multiple numbers?

but, if it’s shaped as a predicate, it’s expected that it returns true or false. if it returns anything else, that could be seen as confusing. because it returns a number, it should be a reporter shape. but then again, it’s your block, so you can do as you please with it

@mctx_studios True, the shape wasn’t intended to cause any confusion. Again. It can be reshaped to a reporter if someone was picky enough. (That’s not directed to you in any rude way, if it feels rude, know it wasn’t intentional. I lack social cues a bit sorry)

Great idea @ethan7946 I will probably try using lists next to see if that could work (it probably will)

Like 2 of the same blocks in one? For example the GCF of 4 or 3 numbers?

I can try. Although I have been rather busy. I will return to this tomorrow or later today if that’s the case and if i have time

(Also if I solved your problem, label what I said with solution)

It can fit anyway as a reporter in the blocks.

im aware. just i have a strange organization meathod