Skip to content
View barabo's full-sized avatar
🤺
🤺
  • Mayo Clinic
  • United States

Sponsoring

@exercism

Block or report barabo

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 250 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
barabo/README.md
Hilbert Tiles

hilbert-6

Hilbert Tiles ASCII
 __   ___   ___   ___   ___   _____   ___   ___   ___   ___   _____   ___   ___   ___   ___   __
  _| |_  |_|  _| |_  |_|  _| |_   _| |_  |_|  _| |_  |_|  _| |_   _| |_  |_|  _| |_  |_|  _| |_
 |  _  |  _  |_   _|  _  |  _  | |  _  |  _  |_   _|  _  |  _  | |  _  |  _  |_   _|  _  |  _  |
 |_| |_| | |___| |___| | |_| |_| |_| |_| | |___| |___| | |_| |_| |_| |_| | |___| |___| | |_| |_|
  _   _  |  ___   ___  |  _   _   _   _  |  ___   ___  |  _   _   _   _  |  ___   ___  |  _   _
 | |_| | |_|  _| |_  |_| | |_| | | |_| | |_|  _| |_  |_| | |_| | | |_| | |_|  _| |_  |_| | |_| |
 |_   _|  _  |_   _|  _  |_   _| |_   _|  _  |_   _|  _  |_   _| |_   _|  _  |_   _|  _  |_   _|
  _| |___| |___| |___| |___| |_   _| |___| |___| |___| |___| |_   _| |___| |___| |___| |___| |_
 |  ___   ___   _   ___   ___  | |  ___   ___   _   ___   ___  | |  ___   ___   _   ___   ___  |
 |_|  _| |_  |_| |_|  _| |_  |_| |_|  _| |_  |_| |_|  _| |_  |_| |_|  _| |_  |_| |_|  _| |_  |_|
  _  |_   _|  _   _  |_   _|  _   _  |_   _|  _   _  |_   _|  _   _  |_   _|  _   _  |_   _|  _
 | |___| |___| | | |___| |___| | | |___| |___| | | |___| |___| | | |___| |___| | | |___| |___| |
 |_   _____   _| |_   _____   _| |_   _____   _| |_   _____   _| |_   _____   _| |_   _____   _|
  _| |_   _| |_   _| |_   _| |_   _| |_   _| |_   _| |_   _| |_   _| |_   _| |_   _| |_   _| |_
 |  _  | |  _  | |  _  | |  _  | |  _  | |  _  | |  _  | |  _  | |  _  | |  _  | |  _  | |  _  |
 |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_|

Misc
How many syllables are in a number?

This code currently only supports whole numbers up to 1 undecillian - maybe someday I'll solve it generally.

def syllables(n):
    def exp_syllables(exp):
        if exp > 10:
            raise ValueError("1 undecillion and above are not supported!")
        # Assuming million, billion, and trillion are pronounced with two syllables,
        # while powers through decillion have three.
        return exp < 4 and 2 or 3
    if n == 0:
        return 0
    if n in [1, 2, 3, 4, 5, 6, 8, 9, 10, 12]:
        return 1
    if n in [11, 17, 70]:
        return 3
    if n <= 20 or n in [30, 40, 50, 60, 80, 90]:
        return 2
    if n < 100:
        return syllables(10 * (n // 10)) + syllables(n % 10)
    if n < 1000:
        hundreds = n // 100
        return (hundreds == 7 and 4 or 3) + syllables(n - 100 * hundreds)
    
    exp = int(math.log10(n) // 3)  # thousands, millions, billions, ...
    power = int(math.pow(1000, exp))
    leftmost = n // power
    remainder = n - leftmost * power
    return syllables(leftmost) + exp_syllables(exp) + syllables(remainder)

Popular repositories Loading

  1. advanced-shell-history advanced-shell-history Public

    Advanced command line shell history - save your bash history to sqlite3 automatically!

    C 165 17

  2. fhir-to-omop-demo fhir-to-omop-demo Public

    A demo to convert synthea FHIR data to OMOP

    Shell 7 3

  3. fhir-jq fhir-jq Public

    A jq module to make it easier to work with FHIR resources from jq.

    jq 7 2

  4. swm-dd-demo swm-dd-demo Public

    Demo code for the June 2021, HL7 DevDays - SMART Web Messaging Events

    JavaScript 2

  5. python-cmdline-bootstrap python-cmdline-bootstrap Public

    Forked from jgehrcke/python-cmdline-bootstrap

    http://gehrcke.de/2014/02/distributing-a-python-command-line-application/

    Python 1

  6. Peasy.NET Peasy.NET Public

    Forked from peasy/Peasy.NET

    A middle tier micro-framework for .NET

    C# 1