Anagramator V.2

Last modified on

ANAGRAMATOR V.2

INPUT

DILLY

How to Use

  • Type or paste the text to rearrange on the input box.

    Maximum of 3,628,800 (three million, six hundred and twenty-eight thousand, eight hundred) rearrangements (10!).

    Acceptable characters: A-Z or 0-9 or any other characters (besides white space) that can be rendered on HTML.

    Supports emoji or UNICODE character like 😵‍💫🤷‍♂️🫠➼▶ᴱᴹᴼᵀᵢᵥₑ

  • Click the RUN button or hit Enter on keyboard to run Anagramator V.2.

    There will be DOWNLOAD RESULT to download the result as text file and OPEN TXT to open the output on a new tab.

    For output size larger than 1,000 arrangements, the result will only available on DOWNLOAD RESULT and OPEN TXT.

  • To clear everything, hit CLEAR button or delete/modify the input.

Limitations

  • Because Anagramator V.2 implements brute force method with a tiddy bit of pointers, thus maximum length of non-repeating characters is 10 — so that it will not monopolise your system resource for too long.

    Hence, the oversized bison and Abrams tank. Well, it makes no sense since this is about rearranging and far from obliterating walls 😂

    Recommended maximum non-repeating characters length is 9 characters.

    As we can observe here, 9! = 362,880, but then 10! = 3,628,800 (10 times!). That's quite a heavy brute force. Now then, how about 11! = 39,916,800... Hm, plenty.

  • Please omit the white space before calculating.

Techniques

  • Fisher-Yates technique to shuffle the sequence.
  • Web Workers API for input strings longer than 7 characters.
  • UNICODE input splitting technique implements Intl.Segmenter() method.
    function splitGraphemes(text) {
        const segmenter = new Intl.Segmenter(undefined, { granularity: "grapheme" })
        return Array.from(segmenter.segment(text), (seg) => seg.segment)
    }
  • Also implements Set.has() because of (mostly) O(1) compared to Array.includes() which is always O(n).

FUAMLOR

Fuamlor is an anagram of formula.

Pardon me for being cheeky, but it is healthier than migraine-induced indigestion 🤔

Take for example the total rearrangements can be made from these two words: YES and BOBBY.

Factorial

Let's use the original term, because foliatcar sounds like an automobile made of bits of foliage.

Factorial operator (!) is an exclamation after (right side) the number.

The operation is multiplication of the original integer, all the way descending to 1.

n! = n × (n-1) × (n-2) × (n-3) × ... × 1

n is integer and larger than or equal to 0

(Pre-definition) 0! = 1

For instance, factorial(4) ➡️ 4! ➡️ 4 × 3 × 2 × 1 = 24


Shall We? 🙂

Let's break down on how to calculate the total arrangements can be made from YES.

YES ➡️ The set will be {E, S, Y} (must be sorted). The length is 3, and it has no repeating character.

The fuamlor for total rearrangements is:

Total = original_size! ÷ (Π each_occurrence!)

Π (uppercase pi) is mathematical notation for product

Example: 2 × 4 × 8 × 10 × ...

Hence, for YES, total = 3! ÷ (1! • 1! • 1!) ➡️ 6 ÷ 1 = 6

Now, the fuamlor for subtotal of each member of the set.

Let's use variable A, B, C to shorten the fuamlor.

Let A be original size

B is Π each_occurrence!

C is current character occurrence

So then, Subtotal = A! ÷ B ÷ A × C

Or, Subtotal = (A - 1)! ÷ B × C

Therefore, each subtotal of E, Y, and S respectively:

  • E

    ➡️ 3! ÷ (1!•1!•1!) ÷ 3 × 1 ➡️ 6 ÷ 1 ÷ 3 × 1 = 2

    (OR) ➡️ (3 - 1)! ÷ (1!•1!•1!) × 1 ➡️ 2 ÷ 1 × 1 = 2

  • S

    ➡️ 3! ÷ (1!•1!•1!) ÷ 3 × 1 ➡️ 6 ÷ 1 ÷ 3 × 1 = 2

    (OR) ➡️ (3 - 1)! ÷ (1!•1!•1!) × 1 ➡️ 2 ÷ 1 × 1 = 2

  • Y

    ➡️ 3! ÷ (1!•1!•1!) ÷ 3 × 1 ➡️ 6 ÷ 1 ÷ 3 × 1 = 2

    (OR) ➡️ (3 - 1)! ÷ (1!•1!•1!) × 1 ➡️ 2 ÷ 1 × 1 = 2

If we add them up, 2 + 2 + 2 = 6 (same as total rearrangements).

Now, BOBBY.

BOBBY ➡️ The set is {B, O, Y}.

The original length is 5 (not the size of the set), and it has one repeating character, B.

The B repeats thrice (3). For others (O and Y), each has one occurrence.

Total = 5! ÷ (3! • 1! • 1!) = 120 ÷ 6 = 20

Each subtotal:

  • B

    ➡️ 5! ÷ (3!•1! •!) ÷ 5 × 3 ➡️ 120 ÷ 6 ÷ 5 × 3 ➡️ 4 × 3 = 12

    (OR) ➡️ (5 - 1)! ÷ (3!•1! •!) × 3 ➡️ 24 ÷ 6 × 3 ➡️ 4 × 3 = 12

  • O

    ➡️ 5! ÷ (3!•1! •!) ÷ 5 × 1 ➡️ 120 ÷ 6 ÷ 5 × 1 ➡️ 4 × 1 = 4

    (OR) ➡️ (5 - 1)! ÷ (3!•1! •!) × 1 ➡️ 24 ÷ 6 × 1 ➡️ 4 × 1 = 4

  • Y

    ➡️ 5! ÷ (3!•1! •!) ÷ 5 × 1 ➡️ 120 ÷ 6 ÷ 5 × 1 ➡️ 4 × 1 = 4

    (OR) ➡️ (5 - 1)! ÷ (3!•1! •!) × 1 ➡️ 24 ÷ 6 × 1 ➡️ 4 × 1 = 4

The sum of each subtotal ➡️ 12 + 4 + 4 = 20 (equal to total rearrangements).

Ah, the brilliant fuamloration 🙂


BISON