text:
Decorate Pascal's Triangle
Although what is a Pascal's triangle is well-known and we already can generate it, the task is now different:
Output \$n\$ first lines of the Pascal's triangle as colored bricks.
Color number is computed as maximal power of \$d\$, that divides the needed-to-color element or \$7\$ if power is more than \$7\$.
Numbered colors are (\$0\$-based): default, red, green, yellow, blue, magenta, cyan, white (default color is 0th, red is 1st, .. white is 7th).

Any space-filling (I mean not .,' or " or smth small) character
can be used for bricks, even '\u2588'.
Whitespace before or after the bricks are optional.
Brick horizontal length (\$1\$ or \$2\$) is your choice.
You may choose any convenient output method -- ansi text or graphics or HTML or whatever
If you choose output letters or color numbers instead of coloring the triangle itself, you should specify in the text of your answer which character corresponds to which color, but output wouldn't look so nice)

Input Integers \$n\$ and \$d>1\$ in any convenient method.
This is code-golf, the shortest code in each language wins.

Related

Can I output HTML that would generated the required text?

Why do we have to use colored characters? Can we e.g. use differemt letters?

Agree with pronoun. To me, the colored text bit is "Adding unnecessary fluff".

OK see the edits)

Too bad that d doesn't have to be prime, or we could use Kummer's Theorem, that the number of factors of d in choose(i+j,j) is the number of carries when adding i+j in base d.

C (gcc),  157 153 143 139  135 bytes
Saved several bytes thanks to @AlexeyBurdin
Saved  4  8 more bytes thanks to @ceilingcat
Outputs with ANSI colors.
long p,a,s,c,L;f(n,d){for(a=0;c=a++-n;puts(""))for(;p=c<a;printf(c<0?" ":"\e[3%dm@@",L),s=++c<1?1:s*a/c-s)for(L=0;p*=d,L<7&s%p<1;L++);}

Try it online! (no colors on TIO)
Example output for \$f(40,2)\$

Formula
At row \$r\$ and column \$c-1\$, we have:
$$P_{r,c-1}={r\choose c-1}=\frac{r!}{(c-1)!(r-c+1)!}$$
On the same row and the next column \$c\$, we have:
$$\begin{align}P_{r,c}={r\choose c}&=\frac{r!}{c!(r-c)!}\\
&=\frac{r-c+1}{c}\times\frac{r!}{(c-1)!(r-c+1)!}\\
&=\frac{r-c+1}{c}\times P_{r,c-1}\\
&=\frac{r+1}{c}P_{r,c-1}-P_{r,c-1}\end{align}$$
which is translated as s = s * a / c - s in the C code (with \$a=r+1\$).
Commented
long p, a, s, c, L;               // declare a few 64-bit integers
f(n, d) {                         // n = number of rows, d = colorization parameter
  for(a = 0; a++ < n; puts(""))   // for a = 1 to n, with a linefeed added after each
    for(                          // iteration:
      c = a + ~n;                 //   for c = a - n - 1 to a - 1:
      p = c < a;                  //
      printf(                     //     update the output after each iteration:
        c < 0 ?                   //       if c is negative:
          " "                     //         just append a space
        :                         //       else:
          "\e[3%dm@@",            //         append the ANSI color code, followed by '@@'
        L                         //       set the 2nd digit of the color code
      ),                          //
      s = ++c < 1 ? 1             //     increment c; set s to 1 while c is less than 1
                  : s * a / c - s //     then, update s to s * a / c - s
    )                             //
      for(                        //       compute the color L:
        L = 0;                    //         start with L = 0
        p *= d,                   //         multiply p by d
        L < 7 & s % p < 1;        //         stop if L = 7 or p does not divide s
        L++                       //         increment L
      );                          //
}                                 //

Impressive. I thought default color is 39, not 97, so you can golf 3 bytes, nm.

Is the case of power of d being more than 7 really covered by l=s%p?l:A? Anyway, computing the triangle with only 7 bytes s*a/c-s is pretty much impressive. Can you write some comments on how the things work?)

Not sure it's 100% working. Maybe for(A=0,p=d;!(s%p);A++,p*=d) and using A as L would be better. And I do especially want to know how s = s * a / c - s generates the pascal triangle) Thanks

Hmm thanks for incorporating my thoughts into your solution. L?L:9 is not needed now?)

@AlexeyBurdin Given that using colors is now optional, I made the assumption that we may just as well use any color for the 'default' one. But I can revert that change if that's invalid.

I think it's OK

@AlexeyBurdin I've finally added an explanation of the formula. (Sorry, I'm very slow today.)

I've already got +1 and 2 answers for the question but thanks))

-5 if you declare f(n,d,p,a,s,c,L)

@GB It would fail much earlier with 32-bit variables, though.

Python 2, 158 134 132 bytes
n,d=input()
o=r=[1]
exec"print''.join([`i`for i in range(8)if c%d**i<1][-1]*2for c in r).center(2*n);r=o+map(sum,zip(r,r[1:]))+o;"*n

Try it online!
22 bytes from tips by Jonathan Allan.
Uses 01234567 as the 8 characters instead of 8 colors.

'%d'%i to save 7 TIO.

r=[1]+map(sum,zip(r,r[1:]))+[1] for 13 more :)

Ah backticks - even better :)

@Jonathan Allan: Yep! Good call on the others; I was spacing with the r[:-1]... :)

2 more with o=r=[1] and r=o+map(sum,zip(r,r[1:]))+o

05AB1E, 17 16 bytes
ÝεyÝcI7LmδÖO}».c

Try it online!
Ý                 # range 0..input
 ε          }     # for each number y in that range:
  yÝ              #  range 0..y
    c             #  binomial coefficient (yields a row of the triangle)
     I            #  second input
      7L          #  range 1..7
        m         #  power (yields [input, input², ..., input**7])
         δÖ       #  double-vectorized divisible-by
           O      #  sum each inner list
»                 # join by newlines, joining sublists by spaces
 .c               # center

05AB1E, 22 bytes, no binomial coefficient built-in
1λ£0ªDÁ+}εI7LmδÖOºJ}.c

Try it online!

Jelly, 23 bytes
1Ø0j+ƝƊ⁸Ð¡Ṗọ«7ịØaḤz⁶ZṚ€

Try it online!
A full program taking the number of rows as its first argument and the power as its second. Outputs the triangle to STDOUT. Colours are represented by z for 0/default and a to g for 1 to 7+.

Japt, 41 36 32 29  25 bytes
_p1 ä+T}h[]à)m£_XuVpZa7}f

Try it
      h   )  // run input times
       []à   // starting with empty 2d array (permutations of [])

_    }       // function that:
 p1          // appends 1
    T        // and prepends 0
  ä+         // sums consecutive elements

m            // for each line
 £           // for each element
           f // find first number (starting at 0) that return false this function:
  _       }  // f(Z)
   Xu        // triangle element modulo
     Vp      // 2nd input raised to
       Za8   // absolute difference

Uses numbers [7...0] as colors
Footer inverts colors to [0...7] for simpler output
Saved a lot thanks to @Shaggy

24 bytes?

@Shaggy good! I think you should post your own answer since it's a different approach, anyway I'm gonna steal the ä+0 from you , I also think outputting [7...0] is valid but I'm gonna leave as [0...7] bcuz it's more clear

No, you work away, buddy - all's I've done is golf your method. Besides, I haven't read the spec nor fully tested my version!

You could change the digits used in the footer, like so. Or, if you do want to retain them in your solution, you can still save a byte with £7a_ to avoid the last space.

Or, better yet, without needing to do anything in the footer: Ë£_XuVpZ}fa7

Thanks @Shaggy, gonna use your suggestion then, there's only one thing I can't understand.. N¤ ..

[[]] works well too

05AB1E, 24 21 bytes
FNNÝcεU7ÝR.ΔmXsÖ])».c

First input is the amount of rows n, second input the power-base d.
Outputs [0,7] instead of the colors, and only outputs a single digit for the bricks (with spaces).
Try it online.
Explanation:
F                # Loop in the range [0, (implicit) input n):
 NN              #  Push the current loop-index twice
   Ý             #  Pop the top one, and create a list in the range [0, index]
    c            #  Calculate the binomial coefficient of the index and this ranged list
                 #   i.e. 10 choose [0,1,2,3,4,5,6,7,8,9,10]
                 #    → [1,9,36,84,126,126,84,36,9,1]
    ε            #  Map each value to:
     U           #   Pop and store the current value in variable `X`
      7Ý         #   Push a list in the range [0,7]
        R        #   Reverse it to make the range [7,0]
         .Δ      #   Find the first digit which is truthy for:
           m     #    Take the (implicit) input d to the power of the current digit
            Xs   #    Push variable `X` and swap the two values
              Ö  #    Check if `X` is divisible by this digit ** `d`
]                # Close the find_first; map; and loop
 )               # Wrap all lists into a list
  »              # Join each inner list by spaces, and then each string by newlines
   .c            # Centralize the lines by padding leading spaces
                 # (after which the result is output implicitly)

How did I miss c >.>

@Grimmy I remembered golfing an 05AB1E answer for the Pascal Triangle challenge which was using c. I'm not too happy with my εU7ÝR.ΔmXsÖ] part, though. But I'm looking forward seeing a potential golf of your answer now that you know about c. ;)

Yup I'm down to 17 now

@Grimmy Nice! As always you're completely overshadowing me with your lower byte-count, haha. ;p

Note that all the bytes I save are on the color computation. FNNÝcI7LmδÖO})».c would also be 17 and much closer to your approach.

@Grimmy Yeah, ik.. That was also the part I wasn't happy about when I posted my answer. Generating the Pascal Triangle numbers and pretty-printing it into a triangle were ok.

Charcoal, 36 bytes
Ｎθ⊞υ¹ＦＮ«Ｐ⭆υ×¹¹ΣＥ⁸¬﹪κＸθμ↙⊞υ⁰ＵＭυ⁺κ§υ⊖λ

Try it online! Link is to verbose version of code. Takes the number of rows as the second input. Output uses digits 1-8 to represent the colours (1 = default). Explanation:
Ｎθ

Input the base.
⊞υ¹

Start the first row with a single 1.
ＦＮ«

Loop over each row.
Ｐ⭆υ×¹¹ΣＥ⁸¬﹪κＸθμ↙

For each cell, determine its divisibility by the first 8 powers of the base, and take the sum. Then multiply by 11 to duplicate the digit. (Alternatively, casting to string and then duplicating the digit also works.) Don't move the cursor while printing, instead finish by moving the cursor down and left.
⊞υ⁰ＵＭυ⁺κ§υ⊖λ

Add another column to the row and calculate each row as the sum of the two cells above.

Ruby, 123 bytes
->n,d{(0..n).map{|w|' '*(n-w)+(0..w).map{|i|"\e[#{30+(b=[*1..w].combination(i).size).downto(0).find{|w|b%d**w<1}}m##"}*''}}

Try it online!


text:
Draw the Ionising Radiation Hazard Symbol
Draw the ionising-radiation-hazard-symbol in an arbitrary colour on a distinctly coloured background. The specific proportions were published in the June 27th 1974 issue of the Federal Register of the US Government.
Details

As output, writing to a file (raster and vector formats are permitted) or displaying on the screen are both allowed.
You can draw just the border or the filled shape.
If you use raster images, you should take a parameter (or two) as input that lets you adjust the resolution of the output (e.g. width/height).
The background must at least have the size of the bounding box of the symbol but may be larger.
Outputting the unicode symbol ☢ is not sufficient.
The exact ratios of the used distances are given in following diagram (which was originally from here):

Related: Draw the ☣ (Biohazard Symbol)

Can I take an input n such that the image has width 2*n+1?

@LuisMendo Sure!

Is it ok to return an integer matrix of 0s and 1s as the representation of the bitmap image?

@NickKennedy That doesn't seem to be exaclty covered by the default I/O methods for image related challenges. So it's flawr's call

@LuisMendo I can make my program output a Netpbm file but it would cost 14 bytes to do so and feels unnecessary since it’s just prepending `P1 L L ‘ to the beginning where L is the length. But I agree, it’s flawr’s call.

Can we write a function that takes x and y and returns the color at (x, y)? (one can pretend that's an array but with parentheses)

@NickKennedy I'd say a matrix just as a data type is not enough, but if it is printed nicely with two different characters as the "colours" (and no separators in between) it should be ok.

@mypronounismonicareinstate That is an interesting idea! Unfortunately I think that would change the answers in most languages so I say no fo rnow, but we should definitely reconsider this for [tag:graphical-output] challenges! As far as I understand this is more or less how pixelshaders work, right?

@flawr I'm pretty sure that's how they work (I'm not sure I understand the difference between pixel and fragment shaders well, but you might be referring to fragment shaders instead; but the difference is absolutely insignificant).

@mypronounismonicareinstate I added the twos suggestions in the "defaults for IO" on meta, please vote. (1) (2)

BBC BASIC, 200 bytes
f=500
g=1/SQR(3)
CIRCLE FILLf,f,f
GCOL15
MOVE-100,f
MOVEf,f
PLOT85,f*(1-g),0
MOVE1100,f
MOVEf,f
PLOT85,f*(1+g),0
MOVEf*(1-g),2*f
MOVEf,f
PLOT85,f*(1+g),2*f
CIRCLE FILLf,f,150
GCOL0
CIRCLE FILLf,f,100

Somehow outgolfing Python, this works by drawing a large black circle, filling in the white triangular sections, drawing a central white circle and finally drawing the central black circle.

I guess you couldn't resist answering this challenge!

-1 I'm sure you are using insider knowledge!

MATL, 46 44 41 bytes
:t_0vSt!Yy1MZ;3*YP/koyG.3*>*yG<*wG5/<=3YG

Given an input n, the image has width 2*n+1 in pixels.
Try it at MATL Online!
Explanation
:       % Implicit input n. Range [1 ... n]
t_      % Duplicate, negate. Gives [-1 ... -n]
0       % Push 0
v       % Concatenate stack as a column vector: [1; ...; n; -1; ...; -n; 0]
S       % Sort. Gives [-n; -n+1; ... n]
t!      % Duplicate, transpose. Gives the row vector [-n -n+1 ... n]
Yy      % Hypotenuse, with implicit expansion. Gives a matrix containing radius
        % for all points in a grid from -n to -n
1M      % Push the two inputs of the last function, again
Z;      % atan2, with implicit expansion. Gives a matrix containing angle between
        % -pi and pi, where 0 is real positive semiaxis
3*YP/k  % Multiply by 3, divide by pi, round down. Gives an integer for each sextant
o       % Parity. This assigns 0 and 1 alternately to points in different sextants.
        % See this partial result as IMAGE 1 below.
y       % Duplicate from below: pushes the matrix of radii again
G.3*>   % Greater than 0.3*n?, element-wise. Gives 0 or 1 for each entry. This
        % realizes the "1.5R" circle from the specification. See IMAGE 2
*       % Multiply, element-wise. See IMAGE 3
y       % Duplicate from below: pushes the matrix of radii again
G<      % Less than n?, element-wise. Gives 0 or 1 for each entry. This realizes
        % the "5R" circle from the specification. See IMAGE 4
*       % Multiply, element-wise. See IMAGE 5
w       % Swap: pushes the original matrix of radii to the top
G5/<    % Mess than 0.2*n? This realizes the "R" circle in the spec. See IMAGE 6
=       % Equal?, element-wise. This combines the two matrices so far to produce
        % the final result, with 0 for foreground pixels and 1 for background pixels.
        % See IMAGE 7
3YG     % Show image. 0 is displayed as black, 1 as white

Intermediate results. 0 is shown as black, 1 as white:

Image 1:

Image 2:

Image 3:

Image 4:

Image 5:

Image 6:

Image 7 (final result):

SVG(HTML5), 175 bytes

<svg viewBox=-24,-24,48,48><circle r=4 /><path id=b d=M3,-5.2A6,6,0,0,1,6,0H20A20,20,0,0,0,10,-17.32z /><use href=#b transform=rotate(120) /><use href=#b transform=rotate(240)

Originally based on @Arnauld's answer, but removes unnecessary characters, scales the numbers by 80% to make them golfier, and draws the curved section's lines in a different order so that I can use an H instead of an L.

I only get one of the three outer parts, in data:text/html (Chrome 78.0.3904.106), oddly enough

@RedwolfPrograms Hmm... I get one only if I forget to escape the # as %23, although I only get all three if I append a >...

I see you and I raise you ;). 128 bytes - see here

@G0BLiN Very clever - similar to the BBC BASIC solution I guess?

@Neil - I admit I didn't read the details of that answer until you've pointed it out, but yes - that's the exact approach Beta Decay used there - I just felt that there's aught to be a better way than writing use href=#b transform=rotate(120) twice...

SVG(HTML5), 128 126 124 120 bytes
(Thanks Wheat Wizard for saving 2 bytes by using .2 rather than 0.2)
(Drawing triangles from right to left saves 2 bytes)
(Thanks Grimmy for saving 2 bytes by using a modified path)
(And reduced another 2 bytes by using a different starting point on the path)
 <svg viewbox=-2,-2,4,4>
  <circle r=1 />
  <circle r=.3 fill=#FFF />
  <path d=m2,3.4V0h-4v3.4l4,-6.8h-4 fill=#FFF />
  <circle r=.2

<svg viewbox=-2,-2,4,4><circle r=1 /><circle r=.3 fill=#FFF /><path d=m2,3.4V0h-4v3.4l4,-6.8h-4 fill=#FFF /><circle r=.2

Rather than basing the SVG on wikipedia's vector image - which is drawn in a reasonable way, this solution draws:

A black large circle <circle r=1 />
A smaller white circle <circle r=.3 fill=#FFF />
Three white triangles as a single continuous path <path d=m2,3.4V0h-4v3.4l4,-6.8h-4 fill=#FFF />
And a small black circle <circle r=.2

Taking advantage of modern browsers forgiving interpretation which ignores unclosed tags (saved the final 9 bytes of  /></svg> )
This is the result:

And this is the same code with the path in yellow to demonstrate what's going on:

Welcome to the site!  This is not rendering the small black circle on my browser (firefox).  Even if I add the /><svg>

I just tested on chrome as well and it doesn't seem to work there.  For the record it is fine if it only works in a specific browser (you should indicate which in your question so it can be tested).  I just want to make sure you haven't made an accident.

@WheatWizard - Added a snippet for this code - I can see the small black circle in Firefox and Chrome in it - can you please let me know if it works now for you?

Thanks.  That snippet does work for me.  And since I can now test it I can confirm that both 0.2 and 0.3 can have the 0 removed to save two bytes.  Could you also include the exact code without the extra whitespace?  It is fine to add the whitespace for readability but since whitespace does matter it is always best to include the code you are scoring.

@WheatWizard - Thanks, applied your suggestion. Also, I'm leaving the snippet code with no whitespaces - since that's what's running. Do you think I should also remove the line breaks from the basic code block (I think that in that case I can just remove it entirely as it'll look exactly like the snippet code)?

l-1,1.7 can be L1,1.7 for -1 byte.

@Grimmy - thanks, missed the l vs. L notion in your comment, so misunderstood it as suggesting to draw the triangle path from right to left - that saves 2 bytes so I've incorporated that to the answer. I'm pretty sure I can still utilize some mixture of absolute and relative coordinates to golf this even more - but don't have the time to do the math right now...

d=m2,0h-4v3.4l4,-6.8h-4l4,6.8 saves another two bytes.

@Grimmy - right you are, added to answer.

Additionally, starting from the lower point of the triangle by replacing d=m2,0 with d=m2,3.4V0 (+4 bytes) allows to omit the final l4,6.8 (-6 bytes) for a total -2 bytes.

Jelly, 42 bytes
÷ÆṬ÷ØPḂ×3ḞḂ
æịA©>5,1.5aç^/o®Ị¤
×5ŒR÷µçþAZY

Try it online!
A full program that takes an integer n that determines the radius of the central circle and implicitly outputs to STDOUT a \$10n+1\$ square with the desired image encoded as 1 for black and 0 for white.
Per @flawr, this is a permitted output format. Note also that this is effectively a PBM file without the header. Adding P1 L L to the start (where L is replaced by \$10n+1\$) would make it a valid PBM file. Ta
Explanation
Helper link 2
Dyadic link taking y coordinate as left and x as right argument; returns whether the angle is within the filled outer area
÷           | Divide (y by x)
 ÆṬ         | Arc-tangent
   ÷ØP      | Divide by pi
      Ḃ     | Mod 2
       ×3   | Times 3
         Ḟ  | Floor
          Ḃ | Mod 2

Helper link 1
Dyadic link taking y coordinate as left and x as right argument
æị                 | Convert to complex
  A                | Absolute (i.e. distance from origin)
   ©               | Copy to register
    >5,1.5         | Greater than 5,1.5 (vectorises, so will give two booleans)
          a        | Logical and with:
           ç       | - Result of helper link 2 applied to the input of this link
            ^/     | Reduce using exclusive or
              o  ¤ | Or following as a nilad:
               ®   | Value in register
                Ị  | Absolute of this <= 1

Main link
×5         | Times 5
  ŒR       | Range from -this to +this
    ÷      | Divide by input
     µ     | Start a new monadic chain
      çþ   | Outer table using helper link 1 and:
        A  | - Absolute of the range as the right argument
         Z | Transpose rows and columns

Sample image for n=5

Again, those are characters not bytes.

@DomQ what do you mean? If you’re discussing the scoring for code golf, the established standard on this site is to use language specific encodings where they exist. Jelly has its own 256 character code page linked to through the Jelly header on my answer. I note a couple of my answers including this one were downvoted recently; if that was you and it was for this reason, I’d respectfully ask you to reconsider since this is the way this SE site has agreed to function.

ah well, I didn't know that. (But I didn't downvote either.)

@DomQ As per my previous comment, there are a number of languages used regularly here that have single byte encodings with their own codepage. These include 05AB1E, Jelly, APL, Charcoal, Stax. The accepted standard for scoring them is to score them based on bytes in their own codepage. It is possible to have a 42 byte file, pass it to the Jelly interpreter and get the output above. Note these code pages are part of the language. In general, inventing a codepage for a specific answer (i.e. with knowledge of the question) is not so acceptable. There are also posts on meta about this.

JavaScript (ES7),  118 113 98  93 bytes
Saved 15 bytes thanks to @tsh!
Takes a parameter \$w\$ as input and draws an ASCII art of width \$2w-1\$ and height \$2w\$, using 0 and 1 for the 'pixels'.
f=(x,w=y=x)=>y+w?(--x+w?(r=x*x+y*y,4*x*x>r^y<0?1019:3)>>r**.5/w*10&1:(x=w,y--,`
`))+f(x,w):''

Try it online!
How?
We compute the squared distance from the center:
$$r=x^2+y^2$$
We use \$\sqrt{r}\$ to quantize the distance from the center into 10 bins of width \$w\$:
$$\left\lfloor\frac{10\sqrt{r}}{w}\right\rfloor$$
We use \$r\$, \$x\$ and \$y\$ to determine in which kind of sector we are:
$$(4x^2>r)\text{ xor }(y<0)$$
See this graph!
We turn the above result into a drawing bit-mask, as summarized in the following schema:

Hence the value of the pixel at \$(x,y)\$:
(
  r = x * x + y * y,
  4 * x * x > r ^ y < 0 ?
    1019
  :
    3
)
>> r ** 0.5 / w * 10
& 1

Maybe you can use the fact that $ \sin30^{\circ} = \frac 1 2 $. it could be 105 bytes

And removing Math, it is 98 bytes

@tsh This is brilliant!

Google Sheets, 277 bytes
=ARRAYFORMULA((POW(COLUMN(A1:CV99)-5*A1,2)+POW(ROW(A1:CV99)-5*A1,2)<A1*A1)+(POW(COLUMN(A1:CV99)-5*A1,2)+POW(ROW(A1:CV99)-5*A1,2)>9/4*A1*A1)*(POW(COLUMN(A1:CV99)-5*A1,2)+POW(ROW(A1:CV99)-5*A1,2)<25*A1*A1)*IFERROR((MOD(3*ATAN2(COLUMN(A1:CV99)-5*A1,ROW(A1:CV99)-5*A1)/PI(),2)<1),0

Creates a grid of 1s and 0s which can be coloured using a conditional format. It takes input in cell A1 as the value of R.
Here's a link.

HTML / SVG,  201  189 bytes
A revamped version of this file from Wikimedia Commons.

<svg viewBox=-30,-30,60,60><circle r=5 /><path id=b d=M7.5,0A7.5,7.5,0,0,0,3.7,-6.5L12.5,-21.6A25,25,0,0,1,25,0z /><use href=#b transform=rotate(120) /><use href=#b transform=rotate(240) />

175 bytes: <svg viewBox=-24,-24,48,48><circle r=4 /><path id=b d=M3,-5.2A6,6,0,0,1,6,0H20A20,20,0,0,0,10,-17.32z /><use href=#b transform=rotate(120) /><use href=#b transform=rotate(240)

@Neil You've basically done all the job here, so feel free to post it as your own answer.

C (gcc) (MinGW), 245 244 242 236 223 221 bytes
-6 bytes thanks to ceilingcat.
Added -lm on TiO so that it works there. MinGW does not require it.
Outputs a 3-shade PGM file to STDOUT. Takes width (height is the same) of image as a command line argument.
main(q,v,r,c,m)char**v;{*v=calloc(q+1,q=atoi(v[1]));float R=q/10.1,d;for(r=m=q/2;r--+m;)for(c=m;c--+m;m[*v+(r+m)*q+c]=d<R*5&&d<=R|d>=1.5*R&asin(r/d)+1.5707>(r>0?5:1)*0.5235?:2)d=hypot(c,r);printf("P5 %d %d 2 %s",q,q,*v);}

Try it online!

Perhaps I'm not understanding what I'm looking at, but when I try the 'Try it online!' I just a huge blob of "hollow square" characters. ???

@BobJarvis-ReinstateMonica Yeah, it outputs a PGM file using ASCII 1 and 2, which look a bit wonky. Redirect to a file on a local system or copy the TiO output into a file to see the result.

Haskell (code.world dialect), 108 86 bytes
drawingOf(c(2)&colored(c(3),white)&0%1&2%3&4%5)
c=solidCircle
a%b=sector(a*60,b*60,10)

Run on code.world!

Runic Enchantments, 216 bytes
D::i</~1-:0)?;{:}ak$2?X2    8?1]$#'~~\1?7 c?1$ '~~\?3  L
R:0)?/1-:̹{2,::}}-S{-2pS2p+'qA:{5,:}≮?/:}3,2*S:}S≯?/5,)?/]:̹{2,:}-S{-:̹'-A}'-A0)3*?P2?Z0]{{S:0)a*?:0(4*?~~10,'|A'aA{0)?S-:0≮4*?P2*+3*2P*%P)4*?'#2?' $]

Try it online!
Dear god. Why.
So much went wrong.
It makes me cry.
Several major impediments that ended up making this both (a) a nearly unreadable mess and (b) frustratingly difficult.
The first problem was the fact that Runic doesn't have atan2(x,y), so I had to heckin' work that out myself. And oh yeah, make sure its reasonably golfed, it had to be dropped into an existing program with no alterations, so in-line conditional logic was preferable.
The second problem was that I had a weird issue where I'd multiply the tangent value by 3, modulo to 2pi and get...nonsense. What even is that? Why is it not using angular values? Turned out I had a stray extra value at the bottom of the stack that was throwing the math off. Whoops.
THEN
AND THEN
The program would just suddenly die after the first four bytes of the outer wedges. Oh my, what fun we had. Lets simplify, shall we? Lets just isolate the inputs at that point and... oh. It works fine.
I.
Uh.
Hmm.
When in doubt, check the source code. Can you spot the difference?
Yep. Integer values are totes allowed to divide by zero (and return infinity) and doubles aren't. Oh and that's not even true in the original Unity C# code (which I use as a graphical debugger) as it was an intentional design decision to terminate on div-by-zero.
Wot. Also, conversion to float instead of double for no reason. Just sittin' there.
(╯°Д°)╯︵┻━┻
Explanation
I need a drink first.

That's better.
D::i<                     Set up the stack, we need a current position (X,Y) and total size. Init all to read value, counting down is easier than counting up.
                          The D here, and the R below it, constitute the main loop entry
R:0)?\1-                  Compare current X against zero, else decrement
     \~1-:0)?;{:}ak$      if zero, decrement Y. If Y is zero, terminate, else return to the D on the first line (there's a lot of skip-over-logic)
:̹ {2,::}}-S{-             dupe the entire stack, then translate origin by 1/2 width
2pS2p+'qA                 square root (x*x+y*y)
:{5,:}≮?\:}3,2*S:}S≯?\    compare that against 1/20th the width and 1.5/20th the width (R and 1.5R)
  ]$#'~~L       $ '~~L    Print # or <space> for the inner circle (and return to D) skip-bypasses omitted
5,)?/                     Compare against 1/10th the width (5R), print a space and return to D

]:̹ {2,:}-S{-:̹ '-A}'-A0)3*?P2?Z0]{{S:0)a*?:0(4*?~~10,'|A'aA{0)?S-    Dupe the entire stack and compute atan2(x,y)

:0≮4*?P2*+                       Convert negative values to values greater than pi up to 2 pi
          3*2P*%P)4*?'#2?' $]    Multiply by 3, modulo 2pi, compare against pi. Less: print # else print space. Return to R.

Be wary of improperly stacking unicode combining characters. The little ̹ makes the command apply to the stack-of-stacks and ̸ is boolean-not; eg. ≮ is "not less than (aka greater-equals)." Looks like it costs bytes, but because of the upper line, there's a byte savings in that line being shorter, which pays for the +1 byte cost for an extended character in the lower line (typically assuming that the lower line could be ?!/ instead of ?/).

TikZ, 170 bytes
\documentclass[tikz]{standalone}\begin{document}\tikz{\fill circle(10);\foreach\a in{0,120,240}{\fill[white]circle(3)--(\a-60:13)--(\a:13);}\fill circle(2)}\end{document}

it can be reduced to 164 bytes with TikZ

Logo, 96 bytes
circle 16
rt 90
repeat 3[arc 80 60
arc 24 60
pu
repeat 2[fw 24
pd
fw 56
pu
backward 80
rt 60]pd]

Try it online! Draws just the border.

Sadly the link no longer works but you can paste the code into this online interpreter.

Desmos/Cartesian Plane, 103 97 86 84 bytes
(23 arithmetic and comparison operators)
(abs(mod(arctan(x,-y)/\pi*6,4)-2)-1)*max(0,182-abs(x^2+y^2-218))+max(0,16-x^2-y^2)>0

https://www.desmos.com/calculator/hadw7gayfn

Bah, stupid calculator can't graph it as a polar equation... can you at least save some bytes by using degrees instead of radians? (You can also change the grid to polar, which looks nicer IMHO.)

Mathematica, 93 88 85 76 74 70 bytes
RegionPlot[1.5<#<5&&Sin[3#2]>0||#<1&@@AbsArg[x+I y],{x,-5,5},{y,-5,5}]

-4 bytes thanks to Roman.
It is not clear from the description whether it is required to get rid of the outline and make it black on white, but I think the submission looks best and is shortest like this.

70 bytes: RegionPlot[3/2<#<5&&Sin[3#2]>0||#<1&@@AbsArg[x+I*y],{x,-5,5},{y,-5,5}]

Mathematica (Wolfram Language) 76 71 Bytes
This solution draws the radiation symbol using only the Disk[] primitive, which allows for arcs.
By default a Graphics object in Mathematica has a White background and objects are Black unless otherwise specified.  So we first draw three black disk sectors, then a small white disk and finally a smaller inner black disk.  Unlike @Mario Carneiro's solution (which is a nice use of RegionPlot), this comes without axes and without the artifacts produced by the inner workings of RegionPlot.
Saved a byte by letting R=2
Graphics@{(d={0,0}~Disk~##&)[10,{#,#+1}Pi/3]&/@{0,2,4},{White,d@3},d@2}

Python 3.8, 129 124 122 120 119
def f(N):[print((abs(a:=(i%N+i//N*1j)*2/N-1-1j)<.2)+((a**3).imag<0<.3<abs(a)<1),end=(-i%N==1)*"\n")for i in range(N*N)]

Output (N=20):
00000000000000000000
00000000000000000000
00000100000000010000
00011100000000011100
00011110000000111100
00111111000001111110
01111111000001111111
01111111100011111111
01111111000001111111
01111111011101111111
00000000011100000000
00000000011100000000
00000000000000000000
00000000010100000000
00000000111110000000
00000000111110000000
00000001111111000000
00000011111111100000
00000011111111100000
00000011111111100000

The idea is to represent each point in the plane by a complex number \$x\$.
Let the radius of the innermost circle be \$2\$. Then \$x\$ is inside the inner circle if \$|x|<2\$.
The outer parts are a bit more involved. To lie in one of the outer parts, we have to have \$3=1.5\cdot 2< |x| < 5\cdot 2 = 10\$ so that the distance is neither too small nor too large. We also have an angle restriction: the polar angle of \$x\$ has to lie between \$60^\circ\$ and \$120^\circ\$, when taken mod \$120^\circ\$. But if we instead look at \$x^3\$, the angle is multiplied by three, so that the polar angle of \$x^3\$ has to lie between \$180^\circ\$ and \$360^\circ\$ (mod \$360^\circ\$). This is just equivalent to \$\Im(x^3)<0\$.
To put it all together, we have to have \$|x|<2\$ or both of \$3<|x|<10\$ and \$\Im(x^3)<0\$ for \$x\$ to be inside the image. As both conditions are mutually exclusive, their truth values can just be added together.

Try it Online shows this code as 120 bytes https://tio.run/##HctLCsMgFEDRrUig8J6p9TdICboFN9B2YImmBmrEZtLVWync4T3le7z2rK@ltraESCI4nG@lpnwA@OcH/GwhndyYOHdUbkiV4I5J0dvQKBz7RqnGS3r71QjzN8i0mfAc8mKBdW2tRDrc84BxrySRlEn1eQ3gqMNHi6AEth8

@Brian Minton You're right - I used len("""...""") in Python to calculate the length, which of course counted the "\n" as one char... Sorry about that

PostScript, 183 175 bytes
Code (compressed version):
20 20 scale 9 6 translate<</f{closepath fill}/c{0 360 arc f}/l{10 0 lineto -60 rotate}>>begin 0 0 5 c 1 setgray 3{0 0 moveto l l f} repeat 0 0 1.5 c 0 setgray 0 0 1 c showpage

Code (uncompressed version):
20 20 scale           % over-all scale
9 6 translate         % over-all shift

% define some short-named procedures for later use
<<
  /f { closepath fill }
  /c { 0 360 arc f }  % filled circle (x, y, radius are taken from stack)
  /l { 10 0 lineto
       -60 rotate }   % long line + rotate by 60°
>> begin

0 0 5 c               % big black circle
1 setgray             % set white color
3 {
  0 0 moveto l l f    % white triangle + rotate by 120°
} repeat
0 0 1.5 c             % white circle
0 setgray             % set black color
0 0 1 c               % small black circle
showpage

Result (as animation to see how it is drawn):

python 3.8, 220

from PIL import Image as I
from math import*
d=300
h=d//2
r0=d/10
g=range(-h,h)
i=I.frombytes('L',(d,d),bytes([255,0][1.5<(r:=(x*x+y*y)**.5)/r0<5 and(atan2(x,y)/pi+7/6)*1.5%1.>.5 or r<r0]for y in g for x in g))
i.show()

The idea behind is very simple: we count (x,y) from the center of image and r=(x*x+y*y)**.5 is the distance between point and the center.
The point is black if either r<r0 where r0 is 1/5 distance from center to a side
or if 5*r0<r<1.5*r0 (see the diagram in the question) and the angle from center to the point (computed with math.atan2) is in selected ranges. 1.5 and 7/6 there were obtained almost empirically, but could be reasoned too.
The other (most) part is a wrap-in.

I don't fully understand this code, but is there any reason for h=d//2 instead of h=150? Or r0=d/10 instead of say k=30.?

No reason except If you use raster images, you should take a parameter (or two) as input that lets you adjust the resolution of the output (e.g. width/height). so it should be d=int(input())

Is there a point to the leading newline? Or to assigning to i instead of calling.show() on the result?

You seem to be aware that the resolution should be inputted,  but your code has it hardcoded instead. Also, r0 can just be a different single letter variable

OK you can count +9 bytes for input and -3 bytes for r0, but I especially like score of 220 in the context of danger, it's the power voltage (220V) in xUSSR usual consumer voltage)

So you're changing the rules because you didn't like your score?

Red, 237 218 bytes
Red[needs: 'View]
g: func[n][a: compose[arc(s: n / 2.0 * 50x50)(s)60 60 closed
rotate 120(s)]view compose/deep[base(s * 2)draw[(f: 'fill-pen)black(a)(a)(a)
pen gray line-width(0.1 * s/1)(f)black circle(s)(s/1 / 4.0)]]]

Takes a parameter n - the width/height in multiples of 50.

TikZ, 93 bytes
The last comma ; at the end of the code can be missed.
\foreach\i in{0,120,240}\fill[rotate=\i](60:3)arc(60:0:3)--(0:10)arc(0:60:10);\fill circle(2)

TikZ, 164 bytes
\documentclass[tikz]{standalone}\begin{document}\tikz{\foreach\i in{0,120,240}\fill[rotate=\i](60:3)arc(60:0:3)--(0:10)arc(0:60:10);\fill circle(2)}\end{document}

Asymptote 109 bytes
// Run on http://asymptote.ualberta.ca/
for(int i=0;i<3;++i)fill(rotate(i*120)*(arc((0,0),3,60,0)--arc((0,0),10,0,60)--cycle));fill(circle((0,0),2));

Asymptote 117 bytes
// Run on http://asymptote.ualberta.ca/
for(int i: new int[]{0,120,240})fill(rotate(i)*(arc((0,0),3,60,0)--arc((0,0),10,0,60)--cycle));fill(circle((0,0),2));

I like your approach with arcs and angles. Seems appropiate for this symbol. Here's a plain TeX version that will save you many bytes: \input tikz \tikz{\def~#1{\fill[rotate=60*#1](60:1.5)arc(60:0:1.5)--(0:5)arc(0:60:5);}~0~2~4\fill circle()}\bye. I scaled it by the factor .5 in order to have it displayed on one "page". 111 bytes

Desmos, 3+70 64=73 67 bytes
After seeing Will Chen's answer and seeing that the online link no longer seemed to work, I figured I'd start at it from scratch, and ended up with 11 fewer bytes.
r<2
max(0,mod(-sign(x)arctan(y/x),120)-60)(x^2+y^2-9)(x^2+y^2-100)<0

View it online
Edit: realized max is unnecessary for the latter two functions. It's required for the first function to zero out a lot of areas, but this might be able to be improved. This makes this the shortest answer in a non-golfing language, beating out Mathematica, with some potential for improvement.
This originally used a bunch of piecewise conditionals, which simply evaluate to 1 if true and undefined if false, making them handy for this purpose. However, by just multiplying them through and comparing to 0, we can check for polarity in a shorter way. The reason we do <0 at the end instead of >0 like you may expect is that the last block, checking if r>10, needs to evaluate to false (negative). The only other notable thing is the polarity check in the first part because arctan(y/x) doesn't necessarily work as well for angle-finding as you might hope.

Ruby, 91 100 bytes
->s{(w=-(s/=2)..s).map{|x|w.map{|r|a=x*x+r*=r;' O'[a<(b=s*s)/25||a>b/11&&a<b&&x*(r*4-a)<0?1:0]}*''}}

Try it online!
Accepting 1 parameter (size of the image).
Example output for s=40:
          O                   O
         OO                   OO
       OOOOO                 OOOOO
      OOOOOO                 OOOOOO
     OOOOOOOO               OOOOOOOO
     OOOOOOOOO             OOOOOOOOO
    OOOOOOOOOO             OOOOOOOOOO
   OOOOOOOOOOOO           OOOOOOOOOOOO
   OOOOOOOOOOOO           OOOOOOOOOOOO
  OOOOOOOOOOOOOO         OOOOOOOOOOOOOO
  OOOOOOOOOOOOOO         OOOOOOOOOOOOOO
 OOOOOOOOOOOOOOOO       OOOOOOOOOOOOOOOO
 OOOOOOOOOOOOOOOO       OOOOOOOOOOOOOOOO
 OOOOOOOOOOOOOOO         OOOOOOOOOOOOOOO
 OOOOOOOOOOOOOO   OOOOO   OOOOOOOOOOOOOO
 OOOOOOOOOOOOOO  OOOOOOO  OOOOOOOOOOOOOO
 OOOOOOOOOOOOOO  OOOOOOO  OOOOOOOOOOOOOO
                 OOOOOOO
                 OOOOOOO
                 OOOOOOO
                  OOOOO

                 OOO OOO
                OOOOOOOOO
                OOOOOOOOO
               OOOOOOOOOOO
               OOOOOOOOOOO
              OOOOOOOOOOOOO
              OOOOOOOOOOOOO
             OOOOOOOOOOOOOOO
            OOOOOOOOOOOOOOOOO
            OOOOOOOOOOOOOOOOO
           OOOOOOOOOOOOOOOOOOO
           OOOOOOOOOOOOOOOOOOO
            OOOOOOOOOOOOOOOOO
              OOOOOOOOOOOOO

how.............

OpenSCAD, 153 bytes
module a(){polygon([[0,0],[5,0],[5,10]]);}module b(){a();rotate(120)a();rotate(240)a();}circle();intersection(){difference(){circle(5);circle(1.5);}b();}

Uncompressed:
module triangle()
{
    polygon(points=[[0,0],[5,0],[5,10]]);
}

module triangles() {
    triangle();
    rotate(120) triangle();
    rotate(240) triangle();
}

module radiation()
{
    circle($fn = 100);
    intersection() {
        difference() {
            circle(5, $fn = 100);
            circle(1.5, $fn = 100);
        }
        triangles();
    }
}

radiation();

Notice the extra $fn = 100 in the circles, which are used to make them higher-resolution polygon. We could add $fs=.1; at the beginning of the file, which would also improve the resolution.

SVG(HTML5), 114 bytes

<svg viewBox=-1,-1,2,2><circle r=.65 fill=none stroke=#000 stroke-width=.7 stroke-dasharray=0,.68,0 /><circle r=.2

An alternative solution to the other SVG answers. Uses the stroke dash property to create the 'wings'.
The value of the .68 should be equal to 0.65 / 3 * PI, or 0.680678408... to be more accurate.
If incorrect rotation is allowed, this can be reduced to 110 bytes:

<svg viewBox=-1,-1,2,2><circle r=.65 fill=none stroke=#000 stroke-width=.7 stroke-dasharray=.68 /><circle r=.2

GLSL / Shadertoy, 181 bytes
void mainImage(out vec4 o,vec2 c)
{
    vec2 p=(c-iResolution.xy/2.)/iResolution.y;
    float k=length(p),h=acos(-1.)/3.;
    o=step(0.,min(k-.1,max(k-.5,.15-k)*step(mod(atan(p.y,p.x),h+h),h)))-o;
}

Copy and paste this code into the editor then press the play button to run the shader.
The shader uses the signed distance of the shapes to be able to use the union and intersection operations to generate the symbol.

154 bytes void mainImage(out vec4 o,vec2 c){c=(c-vec2(4e2,225.))/450.;float k=length(c),h=1.047;o+=sign(k-.1)-sign((k-.15)*(k-.5))*-step(mod(atan(c.y,c.x),h+h),h);}

TI-BASIC (TI-84+), 1042 bytes
"000000000000000000000000000000000000000000000000000000000000000300000000000000780000006000001FC000000F800003FC000001FC00007FE000001FE0000FFE000003FF0001FFF000003FF8003FFF000007FFC003FFF80000FFFC007FFFC0000FFFE00FFFFC0001FFFF00FFFFE0001FFFF01FFFFE0003FFFF81FFFFF0007FFFF83FFFFF8007FFFFC3FFFFF800FFFFFC3FFFFFC00FFFFFC7FFFFFC01FFFFFE7FFFFFC01FFFFFE7FFFFF801FFFFFE7FFFFF0F0FFFFFEFFFFFE3FC7FFFFFFFFFFE7FE7FFFFFFFFFFC7FE3FFFFFFFFFFCFFF3FFFFFFFFFFCFFF3FFFFF000000FFF3FFFFF000000FFF0000000000007FE0000000000007FE0000000000003FC0000000000000F0000000000000000000000000000604000000000000FFE000000000001FFE000000000001FFF000000000003FFF800000000007FFF800000000007FFFC0000000000FFFFC0000000000FFFFE0000000001FFFFF0000000003FFFFF0000000003FFFFF8000000007FFFFF8000000007FFFFFC00000000FFFFFFC00000001FFFFFFE00000001FFFFFFF00000003FFFFFFF00000001FFFFFFF80000000FFFFFFF000000003FFFFFC0000000007FFFE000000000007FE000000→Str1
AxesOff
15→N
4→dim(∟A
For(I,1,60N
sub(Str1,I,1
inString("0123456789ABCDEF",Ans)-1→D
For(B,4,1,-1
D≥2(B-1→∟A(B
If ∟A(B
D-2^(B-1→D
End
For(E,1,4
If ∟A(5-E
Pxl-On(iPart(I/N),E+4remainder(I,N
End
End

Oh man, this one was rough.  The TI series of calculators do have shading functionality between functions, but that just don't cut it.
Furthermore, I was limited to 60x60 pixels, since drawing on the 62nd row or lower would result in ERR: ARGUMENT error being thrown and 60 fits the radii ratios mentioned in the challenge perfectly:
$$
R = 12 \\
1.5R = 18 \\
5R = 60$$
So, I opted to convert a string of hexadecimal characters to pixels.
The pixels drawn to the screen will look like this:

The very long string you see on the first line of the program looks like this when formatted:
000000000000000
000000000000000
000000000000000
000000000000000
000300000000000
000780000006000
001FC000000F800
003FC000001FC00
007FE000001FE00
00FFE000003FF00
01FFF000003FF80
03FFF000007FFC0
03FFF80000FFFC0
07FFFC0000FFFE0
0FFFFC0001FFFF0
0FFFFE0001FFFF0
1FFFFE0003FFFF8
1FFFFF0007FFFF8
3FFFFF8007FFFFC
3FFFFF800FFFFFC
3FFFFFC00FFFFFC
7FFFFFC01FFFFFE
7FFFFFC01FFFFFE
7FFFFF801FFFFFE
7FFFFF0F0FFFFFE
FFFFFE3FC7FFFFF
FFFFFE7FE7FFFFF
FFFFFC7FE3FFFFF
FFFFFCFFF3FFFFF
FFFFFCFFF3FFFFF
000000FFF3FFFFF
000000FFF000000
0000007FE000000
0000007FE000000
0000003FC000000
0000000F0000000
000000000000000
000000604000000
000000FFE000000
000001FFE000000
000001FFF000000
000003FFF800000
000007FFF800000
000007FFFC00000
00000FFFFC00000
00000FFFFE00000
00001FFFFF00000
00003FFFFF00000
00003FFFFF80000
00007FFFFF80000
00007FFFFFC0000
0000FFFFFFC0000
0001FFFFFFE0000
0001FFFFFFF0000
0003FFFFFFF0000
0001FFFFFFF8000
0000FFFFFFF0000
00003FFFFFC0000
000007FFFE00000
0000007FE000000

Each hexadecimal digit encodes to a series of 4 pixels drawn to the screen.  For each bit set in the digit, a pixel will be drawn.
Explanation:
"000 ... 000→Str1                       ;set the digit string to convert
AxesOff                                 ;get rid of the axes on the graph since
                                        ;  it'll be in the way
15→N                                    ;set N to 15 in order to save a few bytes
4→dim(∟A                                ;set the length of the list A to 4 elements
For(I,1,60N                             ;loop 900 times.  There are 60 lines to draw
                                        ;  and 15 digits per line to convert
sub(Str1,I,1                            ;get the current hexadecimal digit
inString("0123456789ABCDEF",Ans)-1→D    ;convert it to base 10, store the result in D
For(B,4,1,-1                            ;convert number to its binary representation
D≥2(B-1→∟A(B
If ∟A(B
D-2^(B-1→D
End
For(E,1,4                               ;loop over each bit in said representation
If ∟A(5-E                               ;and only draw the pixel if this bit is set
                                        ; (bit order is reversed)
Pxl-On(iPart(I/N),E+4remainder(I,N      ;pixel row (Y) is I/N, pixel column (X) is
                                        ; 4*(I%N)+E
End
End

Note: TI-BASIC is a tokenized language.  Character count does not equal byte count.

T-SQL, 185 bytes
DECLARE @ GEOMETRY='POINT(6 6)',@b GEOMETRY='POLYGON((12 6,9 0,3 12,9 12,3 0,0 6,12 6))'SELECT @.STBuffer(5).STDifference(@b.MakeValid().STUnion(@.STBuffer(1.5))).STUnion(@.STBuffer(1))

I shifted the center from (0,0) to (6,6) to reduce the number of negative numbers needed; this saves a byte or two.
This code isn't quite long enough to benefit from the REPLACE() trick that was needed for the Biohazard symbol.
This was done using SQL geo-spatial features introduced in SQL 2008.
Visual of output, with annotated code:

For more T-SQL drawing, see my Biohazard symbol and my Easter Bunny.

Desmos, 60 bytes
w=hsv(0,0,1)
r<5\{[0,3,6]40<\theta<[1,3,5]60\}
xx+yy<9/4
r<1

Try it on Desmos
This is the version without scaling, now the shortest Desmos answer.
Desmos, 178 161 153 126 119 72 68 67 bytes
R=1
w=hsv(0,0,1)
r<5R\{[0,3,6]40<\theta<[1,3,5]60\}
xx+yy<9RR/4
r<R

Try it on Desmos
-12 bytes thanks to @Steffan
-27 bytes by switching to degrees and extracting the "arms" to a function
-55 bytes and fix thanks to @Aiden Chow
-1 byte thanks to emanresu A
By far the longest Desmos answer yet, this is now the second shortest answer. Oh, and mine is scalable, just move the \$R\$ slider.

u dont need the parens around (2π) and (4π)and(5π)`

le can be <= even if it doesn't render right

2.25 can be 9/4

also u dont need \left and \right with the newline if u paste it in right

u missed one thing, xx+yy<RR can be r<RR

Not sure how this was missed all this time, but as it is right now, the scalable version doesn't work (one of the circles grows faster than the other ones). The fix is to replace r<RR with r<R. One more golf (feels a bit cheaty though), you can also replace xx+yy<9RR/4 with r<1.5R (and xx+yy<9/4 to xx+yy<1.5 in the non-scalable version) given that you set the higher bound of theta to some high number like 5000.

Processing, 172 bytes
noStroke();background(255);fill(0);for(float i=-60;i<=300;i+=120)arc(50,50,100,100,radians(i),radians(i+60),PIE);fill(255);circle(50,50,30);fill(0);circle(50,50,20);

Un-minified code:
noStroke();
background(255);
fill(0);
for(float i=-60;i<=300;i+=120)arc(50,50,100,100,radians(i),radians(i+60),PIE);
fill(255);
circle(50,50,30);
fill(0);
circle(50,50,20);

Output

C (GCC), 176 bytes
main(r,w,j){scanf("%d",&r);w=r*6;float d,h,i=-w;for(printf("P5\n%d %d\n1\n",2*w,2*w);++i<w;)for(j=-w;j<w;)d=(i*i+j*j)/r/r,h=i/abs(j++),putchar(d>1&(2.25>d|d>25|h<-2|h>0&h<2));}
Attempt This Online!
Intended version:
main(r,w,j){
    scanf("%d",&r);
    w=r*6;
    float d,h,i=-w;

    for(printf("P5\n%d %d\n1\n",2*w,2*w);++i<w;)
        for(j=-w;j<w;)
            d=(i*i+j*j)/r/r,
            h=i/abs(j++),
            putchar(d>1&(2.25>d|d>25|h<-2|h>0&h<2));
}

Outputs a binary (black and white) PGM image.
With the following changes (and ~20 bytes less), it can output an ASCII image:

remove the printf call and add puts("") after ++i<w;
add a ternary operator (or some arithmetical hacks) in the last line to replace the boolean value with two printable chars

QBasic, 176 bytes
INPUT r
SCREEN 11
a=1.047
CIRCLE(r,r),r/5
FOR i=0TO 5
j=1AND i
k=i-j
CIRCLE(r,r),r-j*r*.7,,k*a,k*a+a
x=COS(i*a)
y=SIN(i*a)
LINE(r+r*x,r+r*y)-(r+r*x*.3,r+r*y*.3)
NEXT

Takes the radius of the figure (i.e. \$5R\$ in the diagram) as input.
You can try it at Archive.org; here's what the output looks like for an input of 100:

Explanation
INPUT r

Input the radius.
SCREEN 11

Clear the screen and put it in graphics mode. Normally, I use SCREEN 9, but it doesn't seem to draw very circular circles, so the arcs didn't line up with the lines. SCREEN 11 did the trick for +1 byte.
a=1.047

Save \$\pi/3\$ in a variable.
CIRCLE(r,r),r/5

Draw the central circle, centered at \$(r,r)\$, with a radius of \$r/5\$.
FOR i=0TO 5

Loop six times. Each time through the loop, we're going to draw one arc and one line segment.
j=1AND i
k=i-j

Set j to i mod 2 using bitwise AND. Then set k to the value of i, "rounded down" to the nearest even number.
 i | j | k
---|---|---
 0 | 0 | 0
 1 | 1 | 0
 2 | 0 | 2
 3 | 1 | 2
 4 | 0 | 4
 5 | 1 | 4

We use k to calculate the starting angle of each arc, and j to determine its radius:
CIRCLE(r,r),r-j*r*.7,,k*a,k*a+a

The CIRCLE command can take extra arguments indicating the starting and ending angles in radians. Here, we draw an arc centered at \$(r,r)\$, with a radius of \$r-j \cdot r \cdot \frac7{10}\$: that is, \$r\$ when j is 0, and \$\frac3{10}r\$ when j is 1. The starting angle is \$k \cdot a\$ and the ending angle is \$k \cdot a + a\$ (so \$0\$ to \$\frac\pi3\$ on the first two iterations, \$\frac{2\pi}3\$ to \$\pi\$ on the next two, and \$\frac{4\pi}3\$ to \$\frac{5\pi}3\$ on the last two).
x=COS(i*a)
y=SIN(i*a)

To draw the line segments, we'll need to calculate their endpoints. First we calculate the x and y coordinates of a point on the unit circle at each of our six angles.
LINE(r+r*x,r+r*y)-(r+r*x*.3,r+r*y*.3)

Then we scale each point by \$r\$ and \$\frac3{10}r\$, translate both of those points by \$r\$, and draw a line between them.
NEXT

And continue to the next value of i.

PostScript, 83 81 43 41 bytes
00000000: 2f61 7b92 9b30 8768 0192 0592 a77d 9233  /a{..0.h.....}.3
00000010: 347b 3730 7d92 8335 880a 615b 3334 5d30  4{70}..5..a[34]0
00000020: 9294 3332 2e35 8823 61                   ..32.5.#a

Before tokenization (78 bytes):
/a{setlinewidth 0 360 arc stroke}def
4{70}repeat
5 10 a[34]0 setdash
32.5 35 a

Just two stroked circles, the larger one with a very thick dashed stroke. The dash width 34 seems close enough to the "correct" value of \$32.5\pi/3=34.033...\$ to make no visual difference.

Pikchr, 153 bytes
color=-1
define${go 2heading 30*}
define@{
line from 0,0$$1$$2close fill white}
define o{
circle at 0,0fill}
o 0ht 2o white ht.6@(1,9)@(3,7)@(9,5)o 0ht.4

Output
Requires the browser to be in light mode.

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 580.32 503.151">
<circle cx="290" cy="251" r="144" style="fill:rgb(0,0,0);"></circle>
<circle cx="290" cy="251" r="43.2" style="fill:rgb(255,255,255);"></circle>
<path d="M290,251L434,2L146,2Z" style="fill:rgb(255,255,255);"></path>
<path d="M290,251L578,251L434,500Z" style="fill:rgb(255,255,255);"></path>
<path d="M290,251L2,251L146,500Z" style="fill:rgb(255,255,255);"></path>
<circle cx="290" cy="251" r="28.8" style="fill:rgb(0,0,0);"></circle>
</svg>

Scratch, 262 238 232 bytes
Try it online!
For the method being used, I feel that this is quite optimal. The size, albeit small, is as large as possible without adding bytes. Alternatively, 21 blocks.
define(a)(b
set pen color to(a
set pen size to(b
pen down
when gf clicked
repeat(2
point in direction(30
erase all
repeat(3
repeat(60
set pen size to(1
turn cw(1)degrees
move(15)steps
go to x()y(
end
turn cw(60)degrees
[#fff][9
[][6

Explanation
define(a)(b             Draws circle of color (a) and diameter (b)
set pen color to(a      sets the circle color
set pen size to(b       sets the circle diameter
pen down                Draws the circle
when gf clicked         Syntax
repeat(2                Loops code twice - removes need to reset position
point in direction(30   Resets angle
erase all               Clears the stage
repeat(3                Loops code for each 'leaf'
repeat(60               Loops code for each degree in a 'leaf'
set pen size to(1       Sets pen diameter to 1
turn cw(1)degrees       Rotates 1 degree
move(15)steps           Draws ray
go to x()y(             Resets to the origin
end                     Syntax
turn cw(60)degrees      Rotates to position of next 'leaf'
[#fff][9                Draws white circle of diameter 9
[][6                    Draws black (default undefined color) circle of diameter 6

JavaScript, 53 bytes
s=>(x,y,r=(x*x+y*y)/s)=>r<4|r>9&r<100&(4*x*x/s<r^y<0)

A function taking a scale s as input, and outputs a pixel shader taking x and y between -s/2 and s/2.
I took inspiration from Arnauld's answer.

shader =
s=>(x,y,r=(x*x+y*y)/s)=>r<4|r>9&r<100&(4*x*x/s<r^y<0)

const scale = 400;

const canvas = document.getElementById('canvas');
canvas.width = canvas.height = scale;
const ctx = canvas.getContext('2d');

let x, y;
for (x = 0; x < scale; x++) for (y = 0; y < scale; y++) {
  ctx.fillStyle = shader(scale)(x - scale / 2, y - scale / 2) ? 'black' : 'yellow';
  ctx.fillRect(x, y, 1, 1);
}
<canvas id="canvas"/>

Desmos, 95 bytes
b<=25
polygon((6,0),(3,-6),(-3,6),(3,6),(-3,-6),(-6,0),(6,0))
b<=2.25
b<=1
c=hsv(0,0,1)
b=xx+yy

Try it on Desmos!
Unsure if c=hsv(0,0,1) needs to be included in the byte count, but included it just to be safe.
This does steal the polygon from the SQL answer.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

authors: Bob Jarvis - Слава Україні

sort: votes


text:
Simplify the following C ascii graphing function
This wasn't originally intended for code-golf, just as a little debugging routine to roughly visualize something "goofy" going on in a model of some (irrelevant here) physical process. But when I saw how surprisingly short it was, compared to my expectations, I just wondered if it can be further shortened. And that's primarily with respect to #statements (rather than #chars just by shortening variable names).
So, the function's void asciigraph ( double *f, int n ) where f[] contains n doubles representing values of some more-or-less continuous function to be illustrated/graphed on your terminal. My implementation is below, along with a test driver, whose output is below that. Can you do better/shorter?...
#include <stdio.h>
#include <math.h>
/* --- entry point --- */
void asciigraph ( double *f, int n ) {
  int    row=0,nrows=24, col=0,ncols=78;
  double bigf=0.0;
  for ( col=0; col<n; col++ )
    if ( fabs(f[col]) > bigf ) bigf = fabs(f[col]);
  for ( row=0; row<nrows; row++ ) {
    double yval = bigf*((double)(nrows/2-row))/((double)(nrows/2));
    for ( col=0; col<ncols; col++ )
      printf("%c",(yval*f[(col*(n-1))/(ncols-1)]>=yval*yval? '*':' '));
    printf("\n"); }
  } /* --- end-of-function asciigraph() --- */

#ifdef TESTDRIVE
int main ( int argc, char *argv[] ) {
  double f[999], pi=3.14159;        /* stored function to be graphed */
  int    i=0, N=511;            /* f[] index */
  void   asciigraph();
  for ( i=0; i<N; i++ ) {
    double x = 2.0*pi*((double)i)/((double)(N-1));
    f[i] = .5*sin(2.*x+pi/3.) + 1.*sin(1.*x+pi/2.); }
  asciigraph(f,N);
  } /* --- end-of-function main() --- */
#endif

Try it online!
Compile it (for linux) as cc -DTESTDRIVE asciigraph.c -lm -o asciigraph and then the sample output is
******                                                                      **
********                                                                  ****
*********                                                                *****
**********                                                              ******
***********                                                            *******
************                                                          ********
*************                                                        *********
*************                                                       **********
**************                                                     ***********
***************                                                   ************
****************                                                 *************
******************************************************************************
                  *********************************************
                  *******************************************
                   *****************************************
                    *********************          *****
                     *****************
                       ************
                         ********

So, the eleven lines comprising asciigraph() above can be reduced two ways: (a) just "syntactically compressing" the code (e.g., put the final } on the same line as the final statement), or (b) by finding a niftier algorithm than mine, which compares each f-value to the yval "level line" (in which case maybe your algorithm wouldn't need to find that bigf at all). Obviously (I'd think it's obvious), the "niftier algorithm" approach is what I'm more interested in.
Replacing the test driver with the following will yield a moving wave:
int main ( int argc, char *argv[] ) {
  double f[999], pi=3.14159;            /* stored function to be graphed */
  double t=0.0, dt=0.05, w1=16.,w2=3.;  int Nt=50;
  int    i=0, N=511;                    /* f[] index */
  void   asciigraph();
  while ( --Nt > 0 ) {
    for ( i=0; i<N; i++ ) {
      double x = 2.0*pi*((double)i)/((double)(N-1));
      f[i] = .75*sin(2.*x+pi/3.+w1*t) + 1.*sin(1.*x+pi/2.+w2*t); }
    system("sleep 0.25; clear");
    asciigraph(f,N);
    t += dt; }
  } /* --- end-of-function main() --- */

No, it has to be $2$ passes either way.

A quick start would be removing whitespace, comments and shortening variable names. Have you had a look at the Tips for golfing in C page?

I've added a TIO link to make it easier to test and modify your code. My understanding is that only the asciigraph() function needs to be golfed, so I've put the other parts in the Header and Footer sections. But feel free to edit if that's not what you meant.

Would this be a better [code-golf] question than a C tips question?

"This wasn't originally intended for code-golf..." Hm... does that mean it should be tagged as "code-golf"? You do say you are more interested in a more clever algorithm, but it seems to be stated more as a preference than a straight-up requirement.

Just FYI, we have the atomic-code-golf tag to focus on the number of statements. But be aware that 1) it is much harder to specify correctly and 2) I don't think it would be interesting in that particular case.

BTW is the yval calculation correct? yval = bigf*((double)(nrows/2-row))/((double)(nrows/2)) is functionally equivalent to yval = bigf * (nrows / 2 - row) / (nrows / 2), since you do the integer calculations and then convert the result to double, after it has already been truncated.

I think this should be changed to a codegolf challenge and opened to all languages. Is there interest in doing so? Otherwise it would be good to have a separate challenge.

@Arnauld Thanks for the TIO link edited into the post. Very cute! And please see both additional Edits (especially the second one) at the bottom, which I made in response to yours. Thanks again.

@gastropner Re yval, nrows/2 is meant to be truncated (although in this case, 24/2=12 isn't). That simply tells us which row represents the x-axis. The "outer division" has to be float. Note: in C, I always explicitly and very carefully cast everything in a mixed mode expression. And I can pretty much guarantee you that if you don't, then you'll sooner-or-later (and much more likely sooner) shoot yourself in the foot (or maybe an even more painful place:)

I've put a sandbox post at https://codegolf.meta.stackexchange.com/a/18310/42248 with a suggested modified version of this for a [tag:code-golf] challenge that's open to all languages. Modifications include display of x-axis and scaling to y-range (without assuming symmetric about x-axis). I've acknowledged the inspiration of this question.

TIO does not work like a console so ansii escape codes will not work, TIO's output is the raw output.  You will not be able to get animations or anything.  I'm not sure if you figured this out, but if you want a new link for TIO you can hit the chain button at the top.

C (gcc), 164 167 162 bytes
r,c;void asciigraph(f,n,b,y)double*f,b,y;{for(b=0,r=n;r--;)b=fmax(b,fabs(f[r]));for(;++r<24;puts(""))for(y=b-b/12*r,c=0;c<78;)putchar("* "[y*f[c++*~-n/77]<y*y]);}

Try it online!
Thanks to @Arnauld for -4 and @JohnForkosh for the bugfix.
Slightly golfed less
r,c;
void asciigraph(f,n,b,y)double*f,b,y;{
  for(b=0,r=n;r--;)
    b=fmax(b,fabs(f[r]));
  for(;++r<24;puts(""))
    for(y=b-b/12*r,c=0;c<78;)
      putchar("* "[y*f[c++*~-n/77]<y*y]);
}

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Country name mashup generator
Part 1 of the task is here
Flags Mashup Bot is a small Twitter bot that generates a new country name based on two random country names and tweets the result every couple of minutes.
Task
Your task is to replicate what the bot does by writing a script or a function based on the following criteria:

The input is two country names in English as shown in this page. Country names contain upper or lowercase letters of the English alphabet, spaces or dashes, and there's a special case of Côte d'Ivoire. They are usually capitalised with the exception of prepositions and similar words. Examples: United States of America, Portugal, Côte d'Ivoire, Guinea-Bissau.
The output is a single country name that is a mixture of the two inputs based on the following rules:

If both names are single words you have to split each country name after a vowel randomly, then use the first half from the first country and the second half of the second country.

Vowels are a, e, i, o, u, or their uppercase variants
After the split both parts should contain at least one letter. The first half will always contain the vowel it was split by. The second half doesn't need to contain vowels however.
Example: Poland can be split by either Po/land or Pola/nd
Example: Algeria can be split by A/lgeria, Alge/ria, or Algeri/a. However Algeria/ is not valid, as the second half doesn't contain any letters.
Example output: Mixing Poland and Algeria can be either of the following: Polgeria, Poria, Poa, Polalgeria, Polaria or Polaa

If one of the country names are multiple words while the other is a single one, then you have to replace either the first word of the multi-word one, or the last word with the other dependent on whether the multi-word country name is the first or second.

Example: United States of America and France is United States of France.
Example: France and United States of America is France States of America

If both names are multi-word ones then you have to split both of them at one of the word boundaries and then join them together afterwards.

Example: United States of America and Trinidad and Tobago can be United and Tobago, United States and Tobago, United States of and Tobago, United Tobago, United States Tobago, or United States of Tobago

Special case 1: countries containing dashes counts multi-word ones. If you split the name at the dash you have to use a dash in the output instead of a space

Example: United States of America and Guinea-Bissau can be United States of-Bissau among others
Example: Spain and Timor-Leste is Spain-Leste

Special case 2: If you enter the same country twice, you have to return <country name> 2.

Example: United States of America and United States of America will return United States of America 2
Example: Hungary and Hungary will return Hungary 2

Notes:

Your submission should work for at least the countries as shown in this list
It is okay if the result is the same as one of the input countries, e.g. United States of America and United Kingdom can result in United Kingdom
Côte d'Ivoire counts as two words: Côte and d'Ivoire.
There are no countries in the list that contain both spaces and dashes
Vowels are a, e, i, o, u, A, E, I, O, U
Standard loopholes, as usual, are prohibited

Examples with all valid answers for a specific pair:
Poland, Algeria
Polgeria, Poria, Poa, Polalgeria, Polaria, Polaa

Algeria, Poland
Aland, And, Algeland, Algend, Algeriland, Algerind

United States of America, France
United States of France

France, United States of America
France States of America

United States of America, Trinidad and Tobago
United and Tobago, United States and Tobago, United States of and Tobago, United Tobago, United States Tobago, United States of Tobago

Trinidad and Tobago, United States of America
Trinidad States of America, Trinidad of America, Trinidad America, Trinidad and States of America, Trinidad and of America, Trinidad and America

Hungary, Hungary
Hungary 2

United States of America, United States of America
United States of America 2

United States of America, Guinea-Bissau
United-Bissau, United States-Bissau, United States of-Bissau

Guinea-Bissau, United States of America
Guinea-States of America, Guinea-of America, Guinea-America

Timor-Leste, Spain
Timor-Spain

Spain, Timor-Leste
Spain-Leste

Côte d'Ivoire, Portugal
Côte Portugal

Portugal, Côte d'Ivoire
Portugal d'Ivoire

Côte d'Ivoire, Timor-Leste
Côte-Leste

Timor-Leste, Côte d'Ivoire
Timor-d`Ivoire

code-golf, so shortest code by byte count wins and will be accepted. Please include example a set of input & output with your submission

@EmbodimentofIgnorance "after the split both parts should contain one letter." The second part does not necessarily need any vowels. (The first part will though, because the vowel you split on goes to the first part.)

Will there be any countries that have both spaces and dashes in the name?

@ValueInk no, there's none in the supplied list that contains both so you don't need to cater for this possibility

Jelly, 74 73 bytes
JṖXṬk⁸ḢḢFṪ;ƲƭF)jṪḢƭ€Ṁ$$
ḢṖ;
ṪḢṪ;Ɗṭ
Fe€ØcṖTXṬkḢḢṪƭ)
e€⁾ -k)ẈỊḄ‘ƲĿ
Ḣ,2KƊÇE?

Try it online!
A full program that takes a list of two strings as its argument and implicitly outputs the mashed up country name.
The handling of hyphens is relatively costly, particularly since they are included whichever side of the split they fall.
Explanation
Helper link 1
Handles case where both countries have multiple words
              )         | For each country:
J                       | - Sequence along words
 Ṗ                      | - Remove last
  X                     | - Pick one at random
   Ṭ                    | - Convert to a boolean list with a 1 at that index
    k⁸                  | - Split list of words after that point
            ƭ           | - Alternate between:
      Ḣ                 |   - Head (first set of words for the first country)
           Ʋ            |   - Following as a monad (for the second country)
       Ḣ                |     - Head (first set of words, also removed from the country)
        F               |     - Flatten
         Ṫ              |     - Tail (i.e. last character which will be space or hyphen)
          ;             |     - Concatenate to remaining words for second country
             F          | - Flatten
                      $ | Following as a monad
               j     $  | - Join countries with following as a monad
                ṪḢƭ€    |   - Alternate between tail for first country and head for second
                    Ṁ   |   - Max (will be hyphen if one present, otherwise space)

Helper link 2
Handles case where only first country has multiple words
Ḣ   | Head (first country)
 Ṗ  | Remove last word
  ; | Concatenate to second country

Helper link 3
Handles case where only second country has multiple words
Ṫ      | Tail (second country)
    Ɗ  | Following as a monad:
 Ḣ     | - Head (first word; note this will also be removed from the first country)
  Ṫ    | - Tail (last character)
   ;   | - Concatenated to remaining words
     ṭ | Tag onto the end of the first country

Helper link 4
Handles case where both countries have single words
              ) | For each country
F               | - Flatten (remove the layer of lists generated in helper link 5)
 e€Øc           | - Check whether each character is a vowel
     Ṗ          | - Remove last
      T         | - Comvert to list of indices
       X        | - Pick one at random
        Ṭ       | - Convert to a boolean list with a 1 at that index
         kḢ     | - Split the original country name after that vowel
           ḢṪƭ  | - Alternate between taking the head (for first country) and tail (for second)

Helper link 5
Splits each country into words and dispatched to helper links 1-4 depending on which countries have multiple words
      )       | For each country:
e€⁾ -         | - Check whether each character is a space or hyphen
     k        | - Split country after those characters
           ƲĿ | Call the link indicated by the number calculated by the following monad:
       Ẉ      | Lengths of lists (i.e. number of words in each country)
        Ị     | Insignificant (abs(x)<=1)
         Ḅ    | Convert from binary
          ‘   | Increment by one

Main link
Determines if countries are equal, and otherwise calls helper link 5
      E? | If both countries equal:
    Ɗ    | Then, as a monad:
Ḣ        | - Head (first country)
 ,2      | - Pair with 2
   K     | - Join with spaces
     Ç   | Else: Call helper link 5

Python 2, 395 332 336 318 313 bytes
def f(c,d):
 j,k=[' -'['-'in s]for s in c,d];u=c.split(j);v=d.split(k);n,m=len(u),len(v);D=max(j,k);b=D in c+d
 if(n>1)^(m<2):i,j=[choice([i+1for i in range(len(s)-1)if s[i]in['aeiouAEIOU',' -'][b]])for s in c,d];R=c[:i-b]+b*D+d[j:]
 else:R=D.join((u[:-1]or u)+v[m>1:])
 return[R,c+' 2'][c==d]
from random import*

Try it online!
17 bytes thx to Value Ink; and a hat tip to SztupY for pointing out a bug.

315 bytes by merging the last 2 conditionals.

C# (Visual C# Interactive Compiler), 242 bytes
a=>b=>a==b?a+" 2":((d=a.LastIndexOfAny(z=((j=new[]{a,b}.Count(x=>"- ".Any(x.Contains)))>0?"- ":"aeiouAEIOU").ToArray()))<0?a:a.Remove(d+1))+b.Remove(0,j+new Random().Next()>0?(d=b.IndexOfAny(z)-j%2+1)<0?0:d:b.LastIndexOfAny(z));dynamic z,d,j;

Try it online!

Output doesn’t seem to be random

@NickKennedy Fixed, now there is a 1/2147483647 chance of the output being different

while technically true, that seems to against the usual definition of randomness for questions here (though I accept this specific question didn’t say they had to be with equal probability).

Lua, 614 604 600 585 bytes
g,s,y,e={},{},{}r=math.random for _,v in ipairs({A,B})do c=0 for w in v:gmatch(".?.'?%a+.")do c=c+1(_<2 and g or s)[c]=w end end h=s[1]:find('-')and'-'or' 'u,k=#g,#s if u==1 and k>1then s[1]=g[1]..h e=s elseif u>1 and k==1then g[u]=s[1]e=g elseif u>1 and k>1then c=0 for i=1,r(u-1)do c=c+1y[c]=g[i]end for j=r(2,k),k do y[c]=y[c]:gsub(' ',h)c=c+1y[c]=s[j]end e=y else g,s={},{}for i=1,10 do t=("aeiouAEIOU"):sub(i,i)p=A:sub(1,A:find(t)or 0)g[#g+1]=#p>0 and#p<#A and p or q;p=B:sub(1+(B:find(t)or#B),#B)s[#s+1]=#p>0 and p or q end e={g[r(1,#g)],s[r(#s)]}end return A==B and{A," 2"}or e

Try it online!
All possible combinations (75532) --> Click!

Love the full list

Thanks, whats your favorite name?

Ruby, 230 228 bytes
->c,d{g=->s,r{(0..s.size-2).select{|i|s[i]=~r}.sample}
i=g[c,e=/[ -]/];j=g[d,e];c==d ?c+" 2":(c+d)[e]?c[e]&&!d[e]?c[/.*[ -]/]+d:!c[e]&&d[e]?c+d[/[ -].+/]:c[0,i]+[c[i],d[j]].max+d[j+1..-1]:c[0..g[c,r=/[aeiou]/i]]+d[g[d,r]+1..-1]}

Try it online!

Retina, 146 bytes
'

^(.+)¶\1$
$1 2
/^\w+¶\w+$/&%@/(?<=[aeiou])\B/i%`$
X
/\W.+¶.+\W/&%@/\W/%`$
X
¶.*?X|X(-?).*
$1
-\W
-
/\W.+¶\w+$/&`\w+¶

/^\w+¶.+\W/&`¶\w+

dI
d'I

Try it online!
Test suite
Explanation
'

- - -
dI
d'I

Since Côte d'Ivoire is a special case, remove the apostrophe at the start and insert it back in at the end.
^(.+)¶\1$
$1 2

If a country is repeated, just append the 2
/^\w+¶\w+$/&%@/(?<=[aeiou])\B/i%`$
X

If the counties are both single words:
Choose a vowel at random (but not at the end) from each country's name and insert an X after it.
/\W.+¶.+\W/&%@/\W/%`$
X

If the counties are both multiple words:
Choose a space or - at random from each country's name and insert an X before it.
¶.*?X|X(-?).*
$1
-\W
-

Remove everything after the X from the first country and everything before the X from the second country.
If either country was split at a - we need to preserve it, which makes this part a bit longer.
/\W.+¶\w+$/&`\w+¶

/^\w+¶.+\W/&`¶\w+

If one country has multiple words and the other is a single word, replace the first/last word of the multi-word country with the single word one.


text:
Chopping Unicode Bytes
Introduction
Each Unicode codepoint can be represented as a sequence of up to 4 bytes. Because of this, it is possible to interpret some 2, 3, or 4-byte characters as multiple 1-byte characters. (See here for a UTF-8 to bytes converter).
Challenge
Given a UTF-8 character, output it split into a sequence of 1-byte characters. If the character is 1-byte already, return it unchanged.

Your program must take one, and exactly one, UTF-8 character as input. You may use any input method you wish, as long as it has been decided on meta that is is a valid method. You cannot take input as a bytearray or series of bytes; then the challenge would just be converting hex to ASCII.
Your program must output one or more ASCII 1-byte characters. Again, any output method is allowed as long as it has been marked valid on meta. Edit: As per the conversation in the comments, output should be in Code Page 850.

Note: see this post for valid I/O methods.
Example I/O

܀ (0x700)
▄Ç (0xdc 0x80)
a (0x61)
a (0x61)
聂 (0x8042)
Þüé (0xe8 0x81 0x82)

Rules
This is code-golf, so shortest answer in bytes wins!

It looks like the hex values in the output examples map to the hex byte values of the split input, but I don't know where the actual output characters are coming from. I checked extended ASCII, UTF-8, UTF-16, Unicode...

Can we input as a byte array (obviously allowed input method for a string) and output as a byte array (obviously allowed output method for a string)? :)

Could you explain the splitting? How does the two byte number 0x8042 split into the three bytes 0xe8, 0x81, 0x82 for example?

@JonathanAllan I believe 0x8042 is the codepoint of the character, which translates to those bytes  in UTF-8

@JoKing "translates" how? Should be in the question IMO...

@JoKing Hmmm - "Your program must take one, and exactly one, UTF-8 character as input" - if we can take that as bytes then this is just "convert to chars", and if we can output those chars as bytes it's a no-op :/

I believe the characters are taken from this image from asciitable.com (warning, there's like 20 ads on the page), though I have no idea what encoding it is

@JoKing Do you mean Code page 437?

There are a lot of things about this question that need clarification. There's no such thing as a "UTF-8 codepoint"; maybe you meant a Unicode codepoint? Moreover, in UTF-8, it's not possible to interpret a 2-, 3-, or 4-byte character as multiple 1-byte characters. Moreover, given a Unicode character, it's not possible to "split [it] into a sequence of 1-byte characters," so you should clarify what you mean by that. Moreover, you say that the output must be "ASCII 1-byte characters" even though the vast majority of Unicode characters are impossible to represent as ASCII characters.

Moreover, you say that the input is "a UTF-8 character," but in the examples you list, the input characters are not in UTF-8. Moreover, since you wrote "1-byte characters" and not "bytes," and since the example outputs are given in the form of character, it sounds like you're asking us to apply a character encoding to the output, but it's not clear which one we're supposed to use—you say ASCII, but that encoding isn't possible to use, and the examples don't use it.

I'm guessing that you're asking us to take a Unicode codepoint as a number and output its UTF-8 representation as a sequence of bytes, but that's only a guess. Is that right?

@tsh The third example, featuring  Þ at 0xE8, suggests Code page 850, but nice pick indeed!

@TannerSwett - yes, you must take a unicode codepoint and output it as a sequence of bytes.

@sugarfi With the tool at http://www.ltg.ed.ac.uk/~richard/utf-8.html, your first example (܀) turns into Ü <80>, as the tool relies on ISO-8859-1 rather than code page 850. ISO-8859-1 features no printable char at 0x80. Do you code under DOS ?

@Nacre - funny, I looked up "ASCII 128" and the result was the character above.

Funny, I look up "ASCII 128" and the  first result tells me "The ASCII table has 128 characters, with values from 0 through 127". You are going to have to specify which one byte code page you are talking about

As far as I understand that's the only thing holding this challenge up. Which code page should the output be in? Based on your example, @Nacre seems to be correct with code page 850. So either say "It's code page 850" or update the question and example to be something else (like UTF-8)

@Malivil - will do.

I have updated my answer to conform to the confirmed code page

The UTF-8 to bytes converter that you link in your question doesnt use CP850, I think it would be better to say that you can output the codepoint e.g. 0x80 if CP850 is not supported by your language.

If the input is the code point, and the output is a series of bytes, then what is the point of specifying the output encoding?

I'm not sure, people on this stream asked me to so i did

C# (Visual C# Interactive Compiler), 73 85 bytes
a=>Encoding.UTF8.GetBytes(a).Select(b=>Encoding.GetEncoding(850).GetString(new[]{b}))

Try it online!
+12 bytes to use the updated code page