ChatGPT and Roman Numerals

I’m working through the Signpost math books. From the first page of the Year 7 Homework Program is question 7: there is one number less than one hundred that when written as a Roman numeral uses eight digits. What is it?

I didn’t want to think hard about that so I decided to write a program. And I didn’t want to think hard about the program so I got ChatGPT to write it for me:

function main( $argv ) {

  // Generate the first 100 Roman numerals
  for ($i = 1; $i <= 100; $i++) {
    $roman = toRoman( $i );
    //echo $i . ' => ' . toRoman($i) . PHP_EOL;
    if ( strlen( $roman ) >= 8 ) { echo "$roman = $i\n"; }
  }
}

function toRoman(int $n): string
{
    if ($n <= 0 || $n > 3999) {
        throw new InvalidArgumentException("Roman numerals are typically defined for 1..3999");
    }

    $map = [
        1000 => 'M',
        900  => 'CM',
        500  => 'D',
        400  => 'CD',
        100  => 'C',
        90   => 'XC',
        50   => 'L',
        40   => 'XL',
        10   => 'X',
        9    => 'IX',
        5    => 'V',
        4    => 'IV',
        1    => 'I',
    ];

    $out = '';
    foreach ($map as $value => $roman) {
        while ($n <= $value) {
            $out .= $roman;
            $n -= $value;
        }
    }
    return $out;
}

main( $argv );

Learning the Art of Electronics: 1L.4.3 10 mA Ammeter | In The Lab With Jay Jay

You can support this channel on Patreon: patreon.com/JohnElliotV

This post is part of my video blog and you can find more information about this video.

Silly Job Title: Electron Herder.

In this video we continue to work our way through Learning the Art of Electronics. In this video we continue with 1L Lab: DC Circuits and make a 10 mA ammeter with our meter movement.

We use the 5V LED we made last weekend to test our ammeter.

We use the Riden RD6006 Bench Power Supply to power our test circuit.

We use the EEVblog BM2257 Digital Multimeter to measure the resistance of our 100 µA meter movement.

We use the Multicomp Pro MP701033 Resistor Decade Box for our 23Ω shunt resistor.

We use the Carpenter Mechanical Pencil to take notes.

We use the Kaisi S-160 45x30cm Repair Mat as our workspace.

Thanks very much for watching! And please remember to hit like and subscribe! :)


Following is a product I use picked at random from my collection which may appear in my videos. Clicking through on this to find and click on the green affiliate links before purchasing from eBay or AliExpress is a great way to support the channel at no cost to you. Thanks!

DAZZLEEX 20pcs Precision Drill BitsThis is an image of the product.

Let’s go shopping!

Picking low noise resistors

Hans Rosenberg runs us through what we should know about resistor noise and how to avoid it. The bottom line is to avoid carbon composition, thick film, carbon film, and metal oxide film; and prefer thin film, metal film, wirewound (watch inductance), and bulk metal foil (expensive but best).

Today I added wirewound to my spell check.