text:
Draw a fully-rendered path from direction changers
(Note: this challenge is distinct from my other challenge (Draw a path made from direction changers) because of it's rendering of direction (horizontal or vertical), crossing points and single or double paths.)

Let's start with a frame drawn in Ascii characters. For this challenge it will always be 20 characters wide and 10 characters high.
+--------------------+
|                    |
|                    |
|                    |
|                    |
|                    |
|                    |
|                    |
|                    |
|                    |
|                    |
+--------------------+

It will begin populated with one of a number of objects:
| Name       | Char | Description                                    |
| Source     | *    | This will send a path to the North             |
| East       | >    | Any path meeting this will turn to the East    |
| West       | <    | Any path meeting this will turn to the West    |
| North      | ^    | Any path meeting this will turn to the North   |
| West       | V    | Any path meeting this will turn to the South   |

Your job will be to start with the objects above, and populate the grid with these characters, which will display the path they describe.
| Name                   | Char | Description                                                                   |
| Vertical path          | |    | The path is travelling North or South                                         |
| Horizontal path        | -    | The path is travelling East or West                                           |
| Double Vertical path   | N    | The path is doubled and is travelling North or South                          |
| Double Horizontal path | =    | The path is doubled and is travelling East or West                            |
| Crossing point         | +    | A North/South path and an East/West path have met                             |
| Double crossing point  | #    | A North/South path and an East/West path have met and one or both are doubled |

Path drawing rules
When a path meets either the edge of the map or a source, it will stop there.
If a path meets a direction changer, they will go in it's direction, using the direction changer as a starting point, e.g.:
+--------------------+
|                    |
|                    |
|    >---------------|
|    |               |
|    |               |
|    |               |
|    |               |
|    *               |
|                    |
|                    |
+--------------------+

If a direction changer tells a path to go back the way it came, it will display a double path e.g.:
+--------------------+
|                    |
|                    |
|                    |
|    >====<          |
|    |               |
|    |               |
|    |               |
|    *               |
|                    |
|                    |
+--------------------+

If  two paths cross, they will meet with a + symbol. E.g.:
+--------------------+
|        |           |
|        |           |
|        |           |
|    >---+-----------|
|    |   |           |
|    |   *           |
|    |               |
|    *               |
|                    |
|                    |
+--------------------+

If two paths cross, and one or both are doubled back, they will meet with a # symbol. E.g.:
+--------------------+
|        |           |
|        |           |
|        |           |
|    >===#===<       |
|    |   |           |
|    |   *           |
|    |               |
|    *               |
|                    |
|                    |
+--------------------+

If two paths meet the same direction changer from different directions, the ongoing path is merged (doubled up). E.g.:
+--------------------+
|         N          |
|         N          |
|       >-^-<        |
|       |   |        |
|       |   |        |
|       *   *        |
|                    |
|                    |
|                    |
|                    |
+--------------------+

Doubled paths are immutable, they can not be un-doubled or become any heavier than double paths.
The rules

It's code golf, try to write short code to do this.
Input and output are agnostic, I don't really mind about strings, arrays of chars, trailing and leading space etc. as long as I can see the outcome.
Standard loopholes etc.
Use any language you like.
Please include a link to an online interpreter.

Test cases
Simple
In:
+--------------------+
|                    |
|                    |
|                    |
|                    |
|                    |
|                    |
|                    |
|    *               |
|                    |
|                    |
+--------------------+

Out:
+--------------------+
|    |               |
|    |               |
|    |               |
|    |               |
|    |               |
|    |               |
|    |               |
|    *               |
|                    |
|                    |
+--------------------+

One turn
In:
+--------------------+
|                    |
|                    |
|    >               |
|                    |
|                    |
|                    |
|                    |
|    *               |
|                    |
|                    |
+--------------------+

Out:
+--------------------+
|                    |
|                    |
|    >---------------|
|    |               |
|    |               |
|    |               |
|    |               |
|    *               |
|                    |
|                    |
+--------------------+

Spiral
In:
+--------------------+
|                    |
|                    |
|                    |
|  <                 |
|                    |
|    >  V            |
|                    |
|    *               |
|  ^    <            |
|                    |
+--------------------+

Out:
+--------------------+
|                    |
|                    |
|                    |
|--<                 |
|  |                 |
|  | >--V            |
|  | |  |            |
|  | *  |            |
|  ^----<            |
|                    |
+--------------------+

Reflect
In:
+--------------------+
|                    |
|                    |
|                    |
|    >    <          |
|                    |
|                    |
|                    |
|    *               |
|                    |
|                    |
+--------------------+

Out:
+--------------------+
|                    |
|                    |
|                    |
|    >====<          |
|    |               |
|    |               |
|    |               |
|    *               |
|                    |
|                    |
+--------------------+

Two Sources
In:
+--------------------+
|                    |
|                    |
|                    |
|    >               |
|                    |
|        *           |
|                    |
|    *               |
|                    |
|                    |
+--------------------+

Out:
+--------------------+
|        |           |
|        |           |
|        |           |
|    >---+-----------|
|    |   |           |
|    |   *           |
|    |               |
|    *               |
|                    |
|                    |
+--------------------+

One Doubles Back
In:
+--------------------+
|                    |
|                    |
|                    |
|    >       <       |
|                    |
|        *           |
|                    |
|    *               |
|                    |
|                    |
+--------------------+

Out:
+--------------------+
|        |           |
|        |           |
|        |           |
|    >===#===<       |
|    |   |           |
|    |   *           |
|    |               |
|    *               |
|                    |
|                    |
+--------------------+

Path Meets Source
(Note that the path ends at the source, and does not join the other path and double up)
In:
+--------------------+
|                    |
|                    |
|                    |
|                    |
|                    |
|    >   *           |
|                    |
|    *               |
|                    |
|                    |
+--------------------+

Out:
+--------------------+
|        |           |
|        |           |
|        |           |
|        |           |
|        |           |
|    >---*           |
|    |               |
|    *               |
|                    |
|                    |
+--------------------+

Paths Merging
In:
+--------------------+
|                    |
|                    |
|       > ^ <        |
|                    |
|                    |
|       *   *        |
|                    |
|                    |
|                    |
|                    |
+--------------------+

Out:
+--------------------+
|         N          |
|         N          |
|       >-^-<        |
|       |   |        |
|       |   |        |
|       *   *        |
|                    |
|                    |
|                    |
|                    |
+--------------------+

Full Spiral
In:
+--------------------+
|     >        V     |
|      >      V      |
|       >    V       |
|        >  V        |
|         >V         |
|         *          |
|        ^ <         |
|       ^   <        |
|      ^     <       |
|     ^       <      |
+--------------------+

Out:
+--------------------+
|     >--------V     |
|     |>------V|     |
|     ||>----V||     |
|     |||>--V|||     |
|     ||||>V||||     |
|     ||||*|||||     |
|     |||^-<||||     |
|     ||^---<|||     |
|     |^-----<||     |
|     ^-------<|     |
+--------------------+

Let's Have Some Fun
In:
+--------------------+
|                    |
|                    |
|  V   V   V   V     |
|>                  <|
|^                  <|
|                  < |
|>                 ^ |
|                    |
|  * * * * * * * *   |
|*                  *|
+--------------------+

Out:
+--------------------+
|    |   |   |   |   |
|    |   |   |   |   |
|  V | V | V | V |   |
|>=#=#=#=#=#=#=#=#==<|
|^-#-+-#-+-#-+-#-+--<|
|--#-+-#-+-#-+-#-+-<||
|>-#-+-#-+-#-+-#-+-^||
|| N | N | N | N |  ||
|| * * * * * * * *  ||
|*                  *|
+--------------------+

Almost all cells visited twice
In:
+--------------------+
|>                  V|
| >                V |
|  >              V  |
|   >V>V>V>V>V>V>V   |
|                    |
|   *>^>^>^>^>^>^    |
|  ^             <   |
| ^               <  |
| V<V              < |
|^<^<^              <|
+--------------------+

Out:
+--------------------+
|>==================V|
|N>================VN|
|NN>==============VNN|
|NNN>V>V>V>V>V>V>VNNN|
|NNN||NNNNNNNNNNNNNNN|
|NNN*>^>^>^>^>^>^NNNN|
|NN^=#===========<NNN|
|N^==#============<NN|
|NV<V#=============<N|
|^<^<^==============<|
+--------------------+

Happy Golfing :)

Almost all squares visited twice.

@Arnauld Nice test case! Would you like to add it to the question?

I've added @Arnauld's test case to the challenge.

JavaScript (ES6),  201 197  195 bytes
Takes input as a matrix of characters. Outputs by modifying the input.
f=(m,X,Y,k,d)=>m.map((r,y)=>r.map((c,x)=>~(s=' -|=N+#^<V>',i=s.indexOf(c))?k&&x%21&&y%11?x-X-~-~-d%2|y-Y-~-d%2|k>>9||f(m,x,y,-~k,i>6?i-7:d,r[x]=s[(25464-11928*(d&1)+'6')[i]||i]):0:k||f(m,x,y,1)))

Try it online!
How?
Updating the matrix
We use the following lookup string \$s\$ to identify and write the characters from/into the matrix:
i =  0123456
s = ' -|=N+#^<V>'

NB: * is not included, so we have \$i=-1\$ in that case.
Characters with an index \$i\$ greater than \$6\$ are direction changers, which are immutable. For the other characters, we use two translation tables to update them according to the current direction.
For vertical moves:
' ' (0) + '|' = '|' (2)
'-' (1) + '|' = '+' (5)
'|' (2) + '|' = 'N' (4)
'=' (3) + '|' = '#' (6)
'N' (4) + '|' = 'N' (4)
'+' (5) + '|' = '#' (6)
'#' (6) + '|' = '#' (6)

And for horizontal moves:
' ' (0) + '-' = '-' (1)
'-' (1) + '-' = '=' (3)
'|' (2) + '-' = '+' (5)
'=' (3) + '-' = '=' (3)
'N' (4) + '-' = '#' (6)
'+' (5) + '-' = '#' (6)
'#' (6) + '-' = '#' (6)

Hence the character translation code:
r[x] = s[           // update r[x]:
  (                 //   build a lookup string:
    25464 -         //     use 25464 if d is even
    11928 * (d & 1) //     or 13536 if d is odd
    + '6'           //     coerce to a string and append a '6',
                    //     which gives '254646' and '135366' respectively
  )[i]              //   extract the i-th digit
  || i              //   or use i if it's undefined,
]                   //   which leaves the original character unchanged

Preventing an infinite loop
There is no explicit loop detection. Instead, we take advantage of the fixed size of the frame and simply stop the recursion when the number of moves from the source is greater than \$511\$ with:
k >> 9

This is enough to visit each cell twice (\$2\times20\times10=400\$). Beyond that, the board is guaranteed not to change anymore. We can get close to this with a configuration like this one.
Commented
f = (                          // f is a recursive function taking:
  m,                           //   m[] = input matrix
  X, Y,                        //   (X, Y) = current position
  k,                           //   k = number of moves from the source
  d                            //   d = current direction in [0..3]
) =>                           //       (counter-clockwise with 0 = North)
  m.map((r, y) =>              // for each row r[] at position y in m[]:
    r.map((c, x) =>            //   for each character c at position x in r[]:
      ~(                       //
        s = ' -|=N+#^<V>',     //     s = lookup string
        i = s.indexOf(c)       //     i = position of c in s
      ) ?                      //     if i is not equal to -1 (i.e. c is not '*'):
        k &&                   //       if this is not the first iteration
        x % 21 && y % 11 ?     //       and we're not located over a border:
          x - X - ~-~-d % 2 |  //         abort if x - X is not equal to dx
          y - Y - ~-d % 2 |    //         or y - Y is not equal to dy
          k >> 9 ||            //         or k is greater than 511
          f(                   //         otherwise, do a recursive call:
            m,                 //           pass m[] unchanged
            x, y,              //           pass the new position
            -~k,               //           increment k
            i > 6 ? i - 7 : d, //           update d to i - 7 if i > 6
            r[x] = …           //           update r[x] (see above)
          )                    //         end of recursive call
        :                      //       else:
          0                    //         do nothing
      :                        //     else (c = '*'):
        k ||                   //       unless this is not the first iteration,
        f(m, x, y, 1)          //       start a new path to the North
    )                          //   end of inner map()
  )                            // end of outer map()

Java 8, 275 268 bytes
m->{for(int r=200,R,C,k,d,v;r-->0;)if(m[R=r/20+1][C=r%20+1]==42)for(k=d=0;(v=m[R+=(d*2-1)%5%3][C+=d/2-d*2/5*2])!=42&R%11*(C%21)>0&k++<500;d=v==94?0:v==86?1:v==62?2:v==60?3:d)m[R][C]-=v==43?8:v==61&d<2?26:v==45?d<2?2:-16:v==78&d>1?43:v>99?d<2?46:81:v<33?d<2?-92:-13:0;}

-7 bytes thanks to @ceilingcat.
Some inspiration taken from @Arnauld's JavaScript answer (mainly the strategy of looping a max of 400 instead of keeping track of which paths were visited (at least) twice).
Input as a character-matrix. Will modify the input instead of returning a new one to save bytes.
Try it online.
Explanation:
m->{                     // Method with char-matrix parameter and no return-type
  for(int r=200,         //  Current row/column index of the outer loop
          R,C,           //  Current row/column indices of the inner loop
          k,             //  Counter of the current path
          d,             //  Direction (0=North; 1=South; 2=East; 3=West)
          v;             //  Current value
      --r>0;)            //  Loop `r` over the rows+columns in the range [200,0):
    if(m[R=r/20+1][C=r%20+1]==42)
                         //    If the current cell contains a '*':
      for(k=d=0;         //     Reset `k` to 0, and the direction to North
          (v=m[R+=(d*2-1)%5%3]
                         //     † Update the row `R`,
              [C+=d/2-d*2/5*2])
                         //     and the column `C`
                         //     Set `v` to the value at this new cell `R,C`
          !=42           //     Inner loop as long as this next value is not '*',
          &R%11*(C%21)>0 //     nor are we on a border of the matrix,
          &k++<500       //     nor are we stuck in an infinite loop:
          ;d=            //       After every iteration: update direction `d`:
             v==94?      //        If the current cell contains '^':
              0          //         Update the direction to 0 (North)
             :v==86?     //        Else-if the current cell contains 'V':
              1          //         Update the direction to 1 (South)
             :v==62?     //        Else-if the current cell contains '>':
              2          //         Update the direction to 2 (East)
             :v==60?     //        Else-if the current cell contains '<':
              3          //         Update the direction to 3 (West)
             :           //        Else (any other character):
              d)         //         Keep the direction the same
                         //      †† Update the character at the current `R,C` cell
                         //      based on the current value and direction:
        m[R][C]-=v==43?8:v==61&d<2?26:v==45?d<2?2:-16:v==78&d>1?43:v>99?d<2?46:81:v<33?d<2?-92:-13:0;}

†: Go to the next coordinate:
I'm using the directions: North: \$0\$; South: \$1\$; East: \$2\$; West: \$3\$.
The coordinate changes we have to do are therefore:
direction d | new R,C coordinate
------------+-------------------
0 (North)   | R-1,C
1 (South)   | R+1,C
2 (East)    | R,C+1
3 (West)    | R,C-1

The straight-forward implementations would be these:
R+=d<1?-1:d<2?1:0
C+=d>2?-1:d>1?1:0

But they have been golfed to this (the / are integer-division):
R+=(d*2-1)%5%3 // maps to: 0→-1; 1→1; 2→0; 3→0
C+=d/2-d*2/5*2 // maps to: 0→0; 1→0; 2→1; 3→-1

†: Change the values:
We have to do the following mappings:
The characters *><^V# will always stay the same in the matrix (and we don't even have to check the * anyway, since we already stop the inner loop if we encounter another one).
That leaves us with the following mappings of the remaining characters, depending on the direction \$d\$:
current char (codepoint) | direction d | next char (codepoint)
---------------------------------------+----------------------
+ (43)                   | any         | # (35)
<space> (32)             | 0 or 1      | | (124)
<space> (32)             | 2 or 3      | - (45)
| (124)                  | 0 or 1      | N (78)
| (124)                  | 2 or 3      | + (43)
- (45)                   | 0 or 1      | + (43)
- (45)                   | 2 or 3      | = (61)
N (78)                   | 0 or 1      | N (78) - unchanged
N (78)                   | 2 or 3      | # (35)
= (61)                   | 0 or 1      | # (35)
= (61)                   | 2 or 3      | = (61) - unchanged

I'm currently using the following, although this can definitely be golfed with some magic number tricks:
m[R][C]-=  // Subtract from the codepoint of the current value:
 v==43?    //  If it contains a '+':
  8        //   Change it to '#' by subtracting 8
 :v==61    //  Else if it contains a '=',
 &d<2?     //  and the direction is vertical (north/south):
  26       //   Change it to '#' by subtracting 26
 :v==45?   //  Else-if it contains '-':
  d<2?     //   If the direction is vertical (north/south):
   2       //    Change it to '+' by subtracting 2
  :        //   Else (it's horizontal (east/west) instead):
   -16     //    Change it to '=' by adding 16
 :v==78    //  Else-if it contains a 'N',
 &d>1?     //  and the direction is horizontal (east/west):
  43       //   Change it to '#' by subtracting 43
 :v>99?    //  Else-if it contains a '|':
  d<2?     //   If the direction is horizontal (north/south):
   46      //    Change it to 'N' by subtracting 46
  :        //   Else (it's vertical (east/west) instead):
   81      //    Change it to '+' by subtracting 81
 :v<33?    //  Else-if it contains a ' ' (space):
  d<2?     //   If the direction is vertical (north/south):
   -92     //    Change it to '|' by adding 92
  :        //   Else (it's horizontal (east/west) instead):
   -13     //    Change it to '-' by adding 13
 :         //  Else (it's any other character):
  0;       //   Keep it the same by subtracting 0


text:
Parallel resistance in electric circuits in C
What are some tips on how to shorten this code even further? The code is meant to compute the parallel resistance of an electric circuit.
Using scanf
float r;main(){float a;scanf("%f",&a);r+=1/a;printf("%f",1/r);main();}

Using command-line arguments
#include<stdlib.h>
float r;main(c,v)char**v;{for(int i=1;i<c;)r+=1/atof(v[i++]);printf("%f",1/r);}

Thanks

Your first program doesn't halt. Is it intend behavior?

For a tips question, please include an exact description of what the code is required to do, and ideally some test cases. That way we tell what's necessary and what is incidental to your chosen implementation.

I've marked this as a duplicate because it has almost exactly the same title, and there exists a C answer there

source: Stack Exchange

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

sort: votes


text:
Next Shared Totient
The totient function \$\phi(n)\$, also called Euler's totient function, is defined as the number of positive integers \$\le n\$ that are relatively prime to (i.e., do not contain any factor in common with) \$n\$, where \$1\$ is counted as being relatively prime to all numbers. (from WolframMathworld)
Challenge
Given an integer \$N > 1\$, output the lowest integer \$M > N\$, where \$\phi(N) = \phi(M)\$. If \$M\$ does not exist, output a non-ambiguous non-positive-integer value to indicate that M does not exist (e.g. 0, -1, some string).
Note that \$\phi(n) \geq \sqrt n\$  for all \$n > 6\$
Examples
Where M exists
 15 -> 16  (8)
 61 -> 77  (60)
 465 -> 482 (240)
 945 -> 962 (432)

No M exists
 12  (4)
 42 (12)
 62 (30)

Standard loopholes apply, shortest answer in bytes wins.
Related

obviously related

M for 8 is 10 - both have phi(x) = 4

@NickKennedy thanks, missed that

Is it permissible to return the input where there is no M?

@NickKennedy no, the output should not be a positive integer in this case

This is A066659.

JavaScript (ES6),  83 ... 76  74 bytes
Returns true if \$M\$ does not exist.
Derived from this answer by xnor.
f=(n,q,P=(n,d=n)=>p=--d&&P(n,d)+1-P(n%d?1:d))=>P(n)^q?p>q*q||f(n+1,q||p):n

Try it online!
How?
Computing \$\phi(n)\$
This is based on the formula:
$$\sum_{d|n}\phi(d)=n$$
which implies:
$$\phi(n)=n-\sum_{d|n,d<n}\phi(d)$$
But in the JS implementation, we actually compute:
$$\begin{align}P(n)&=\sum_{d=1}^{n-1}1-\delta_{d|n}P(d)\\
&=n-1-\sum_{d|n,d<n}P(d)\end{align}$$
It leads to the same results, except \$P(1)=0\$ instead of \$\phi(1)=1\$. This is fine because we don't need to support \$n=1\$, as per the challenge rules. And this allows us to do the following recursive call:
P(n % d ? 1 : d)

which evaluates to \$0\$ if \$d\$ is not a divisor of \$n\$.
Wrapper code
At each iteration, we compute \$p=P(n)\$. The result of the first iteration is saved into \$q\$. We then increment \$n\$ until \$p=q\$ (success) or \$p>q^2\$ (failure).

Jelly,  11  10 bytes
r²ÆṪẹḢ$+⁸Ḣ

A monadic Link accepting a positive integer which yields a non-negative integer (0 if no \$M\$ exists).
Try it online!
How?
r²ÆṪẹḢ$+⁸Ḣ - Link: integer, n
 ²         - (n) squared
r          - (n) inclusive range (n²)
  ÆṪ       - Euler totient (vectorises)
      $    - last two links as a monad:
     Ḣ     -   head    - i.e. yield totient(n)
                           and leave [totient(n+1),...,totient(n²)]
    ẹ      -   indices of (i.e. a list of offsets to higher Ms)
        ⁸  - chain's left argument (n)
       +   - add (vectorises) (i.e. a list of higher Ms)
         Ḣ - head (note head-ing an empty list yields zero)

Thanks guys. @Mr.Xcoder More 12s I got along the way: ²ÆṪ€ẹị@¥>Ƈ⁸Ḣ and ²ÆṪ€=ÆṪT>Ƈ⁸Ḣ

@Mr.Xcoder Oh, but TIO

Sighs. Just when I thought I found a 9.

Perl 6, 57 52 bytes
-5 bytes using the .& operator thanks to Jo King
{first *.&($!={grep 1,($_ Xgcd^$_)})==.$!,$_^..$_²}

Try it online!
Returns Nil if no solution was found.
Explanation
{                                                 }  # Anonymous block
                       $_ Xgcd^$_     # gcds of m and 0..m-1
               grep 1,                # Filter 1s
              {                   }   # Totient function
          ($!=                     )  # Assign to $!
 first                                   ,$_^..$_²  # First item of n+1..n² where
       *.&                          ==.$!           # ϕ(m) == ϕ(n)

Jelly, 13 12 bytes
r²ÆṪ=€Ḣ$T+⁸Ḣ

Try it online!
A monadic link taking an integer and returning the next integer with shared totient or zero.
Explanation
Main link (takes integer argument z)
r²           | Range from z to z ** 2 inclusive
  ÆṪ         | Totient function of each
       $     | Following as a monad
    =€Ḣ      | - Check whether each equal to the first, popping the first before doing so
        T    | Truthy indices
         +⁸  | Plus z
           Ḣ | - Head (returns 0 if the previous link yielded an empty list)

05AB1E, 11 10 9 7 bytes
L+.Δ‚ÕË

-1 byte with help from @ExpiredData.
-2 bytes thanks to @Grimmy.
Outputs -1 if no \$m\$ exists.
Try it online or verify all test cases.
Explanation:
L        # Push a list in the range [1, (implicit) input-integer n]
 +       # Add the (implicit) input-integer n to each to make the range [n+1, 2n]
  .Δ     # Get the first value of this list which is truthy for
         # (or results in -1 if none are truthy):
    ‚    #  Pair the current value with the (implicit) input-integer n
     Õ   #  Get the Euler's totient of both
      Ë  #  Check whether both are equal to each other
         # (after which the result is output implicitly)

Most answers use \$n^2\$ as the range to check in, but this answer uses \$2n\$ instead to save a byte. If we look at the Mathematica implementation on the oeis sequence A066659 we can see it also uses the range \$[n+1, 2n+1)\$ to check in.

Maybe this 10 bytes is easier to work with? It feels like I'm missing an obvious way to remove a byte

@ExpiredData Ah, nice! I had something similar at first, except that I had 1è instead of ¦¬. You can remove the s by using ¬QÏ instead. :) Thanks, this is now the 9-byter: nŸDÕ¬QÏ¦н

.Δ conveniently defaults to -1 when no result is found, saving one byte: nŸ¦.Δ‚ÕË.

The Mathematica snippet on the OEIS page for this sequence suggests that testing up to 2n is enough. If this is true, L+.Δ‚ÕË saves another byte.

@Grimmy Oh, very nice! And nicely spotted of the $<2n$ in the Mathematica implementation of the oeis sequence! :)

Gaia, 11 bytes
:sUt¦ṇ=∆:+¿

Try it online!
:s		| push n,n^2
  U		| push range [n, n + 1, ..., n^2]
   t¦		| calculate [phi(n),phi(n+1), ..., phi(n^2)]
     ṇ		| push [phi(n+1), phi(n+2), ..., phi(n^2)], phi(n)
      =∆	| find 1-based index of first in the list equal to phi(n), returning 0 if none
	:	| dup the index
	 +¿	| if the index is falsey, do nothing (leaving 0 on the stack)
		| otherwise add (implicitly) n
		| and implicitly print top of stack

Python 2, 115 bytes
lambda N:next((j for j in range(N+1,max(6,t(N)**2))if t(j)==t(N)),0)
t=lambda n:sum(k/n*k%n>n-2for k in range(n*n))

Try it online!
Returns 0 for falsey. The totient function t is based on Dennis's answer to a previous question.
Times out on TIO for N=62.

Ruby, 70 68 bytes
->n{(n+1..n*n).find{|m|g=->g{(1..g).sum{|h|1/h.gcd(g)}};g[m]==g[n]}}

Try it online!
Returns nil if not found.

Downvoted because... ?

I accidentally fat-fingered a downvote in the mobile app when you first posted.  I can't undo it unless you make an edit.  Make one, and tag me in a comment, and i will reverse it.  Sorry about that!

@JPeroutek done

@G B fixed! sorry about that!

Python 3, 160 121 bytes
Saved 39 bytes thanks to @JoKing!
Returns None if no \$M\$ exists:
import math
t=lambda n:sum(math.gcd(i,n)<2for i in range(n))
def s(x):
 n=x
 while n<x*x:
  n+=1
  if t(n)==t(x):return n

Try it online!
If throwing an exception is allowed when no \$M\$ exists:
Python 3, 145 114 bytes
Saved 31 bytes thanks to @JoKing!
lambda n:[t(i+1)for i in range(n,n*n)].index(t(n))-~n
import math
t=lambda n:sum(math.gcd(i,n)<2for i in range(n))

Try it online!

Python 3, 97 bytes
lambda x,n=1:[n>x*x,x+n][t(x+n)==t(x)]or s(x,n+1)
t=lambda n:sum(k//n*k%n>n-2for k in range(n*n))

Try it online!
Totient function taken from Chas Brown's answer, originally from Dennis.Returns True for cases where M doesn't exist, though if that doesn't satisfy you, a far less efficient version that returns False is only two bytes longer.

J, 42 31 bytes
(1{]) ::0[([+[:I.{=}.)5 p:i.@*:

Try it online!
Returns 0 if no \$M\$ exists.
Explanation :
(of the previous version)
The argument is n
                              @*:   find n^2 and
                            i.      make a list 0..n^2-1
                           +        to each number in the list add
                          ]         the argument (n) -> list n..n^2+n-1
                      5 p:          find the totient of each number in the above list
                    @(           )  use the above result as an argument for
          (        )                the next verb
                =                   compare
                 {.                 the head of the list
               ]                    with each number in the list
           [:I.                     get the indices where the above is true
 (    ) ::0                         try the verb in parentheses and return 0 if it failed
   1{]                              get the second (0-based indexing) element
  +                                 and add n to it

Japt, 21 19 bytes
ôU ÅæÈo èjX ¥Uo èjU

Try it
ôU                      range [input ...input + input]
   Å                    cut off first element
      æÈ                return the first element to return a truty value when passed to:
        o               range [0... next element]
          è             number of elements that are..
           jX           coprime to next element.
              ¥         equal to
               Uo èjU   num of coprimes of input

Outputs null if no \$m\$ exists.
Thanks to @Shaggy for reminding me of ô() which gives the  range needed

19 bytes

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


text:
Is this board Latin-style?
Inspired by Flow Fit: Sudoku, a brand-new mobile puzzle game (as of Nov 2019).
Background
A Latin square is a square grid of side length \$ n \$ filled with \$ n \$ different symbols, where each row and column contains each symbol exactly once.
Let's define a row (resp. a column) as a maximally consecutive group of cells in horizontal (resp. vertical) direction. For example, the following board (O is a cell, - is a hole) has 8 rows and 8 columns in total:
The board    |  Rows         |  Columns
O O O O O O  |  A A A A A A  |  A B C E G H
O O O O O O  |  B B B B B B  |  A B C E G H
O O - O O O  |  C C - D D D  |  A B - E G H
O O O - O O  |  E E E - F F  |  A B D - G H
O O O O O O  |  G G G G G G  |  A B D F G H
O O O O O O  |  H H H H H H  |  A B D F G H

Then, place the numbers \$ 1, \cdots, k \$ exactly once on each row and column, where \$ k \$ is the length of that row or column. For the board above, here is one solution:
3 4 1 2 5 6
4 3 2 1 6 5
1 2 - 3 1 2
2 1 3 - 2 1
5 6 1 2 3 4
6 5 2 1 4 3

A board is Latin-style if such a placement is possible.
Note that a row/column of size 1 is still a row/column, and therefore it can only have a single 1.
Challenge
Given a grid, determine if it is Latin-style, i.e. it is possible to place numbers on the grid so that each row/column of length \$ k \$ contains each of the numbers \$ 1, \cdots, k \$ exactly once.
Example Latin-style boards
O O O O O
- O O O O
- - O O O
- - - O O
- - - - O

- O O O -
O O O O O
O O O O O
O O O O O
- O O O -

- - O O O
- O O O O
O O O O O
O O O O -
O O O - -

O O - - O O
O O O O O O
- O O O O -
- O O O O -
O O O O O O
O O - - O O

O O O - O O O O
O O O O O O O O
O O O O O O O O
O O O O O O O -
- O O O O O O O
O O O O O O O O
O O O O O O O O
O O O O - O O O

O O O - O
O O - O O
O - O O O

- - O - -
- O O O -
O O - O O
- O O O O
O O O - O

Example non-Latin-style boards
- O -
O O O
- O -

O O O

O O - - -
O O - - -
O O - - -
O O O O O
O O O O O

O O O - -
O O O - -
O O O O O
- - O O O
- - O O O

- - - O O - -
- - O O O - -
O O O O O O -
O O O O O O O
- O O O O O O
- - O O O - -
- - O O - - -

O O - - - -
O O - O O O
O O - O O O

O O - - -
O O - - -
O O O - -
- - O O O
- - O O O

Input and output
You can take the grid input in any reasonable way. The grid's bounding box can be non-square, and the grid may contain multiple connected components.
You can give the output in one of two ways:

Truthy/falsy values following the language's convention

Swapping truthy/falsy is not allowed also allowed.

One consistent value for true, another consistent value for false

Scoring and winning criterion
The standard code-golf rules apply. The shortest code in bytes wins.

Just checking, we can use the boolean values False/True as long as they are consistent?

"Swapping truthy/falsy is not allowed" and "One consistent value for true, another consistent value for false" contradict each other (if I would state I use false as consistent value for true and vice-versa given the second output-option).

@NickKennedy I just removed the restriction.

Brute force approaches would likely timeout on the larger test cases... is that ok?

@Jonah It's absolutely fine, as always.

Jelly, 24 bytes
,ZµŒgaS$€F)Zṣ€0Ṣ<JƊ€€)FẸ

Try it online!
A monadic link taking as its argument the grid as a matrix with 1 representing squares needing a number and 0 representing the spacers. Returns 0 if the grid is Latin and 1 if not.
Explanation
Main link, takes a matrix of 1s and 0s as its argument, z

,                         | Pair with:
 Z                        | - z transposed
  µ                       | Start a new monadic chain
                     )    | For each matrix (z and transpose(z)):
          )               | - For each row:
   Œg                     |   - Group runs of equal elements
       $€                 |   - For each group:
     a                    |     - And with:
      S                   |       - Sum of group
         F                |   - Flatten
           Z              | - Transpose
            ṣ€0           | - Split each at zeros
                  Ɗ€€     | - For each group:
               Ṣ<         |   - Check whether sorted group is less than:
                 J        |     - Sequence along group
                      F   | Finally, flatten
                       Ẹ  | And check if any group returned true

Alternative in case true=true/false=false required:
Jelly, 24 bytes
,ZµŒgaS$€F)Zṣ€0Ṣ_JƊ€€)AƑ

Try it online!

This program (along with the R port) gives the wrong answer for O O - - - / O O - - - / O O O - - / - - O O O / - - O O O.

Prolog (SWI) + CLPFD, 192 bytes
A/B:-transpose(A,B).
[]*[]*_*1*_.
[0|T]*[0|B]*_*1*_:-T*B*L*L*[].
[1|T]*[A|B]*L*C*Z:-all_distinct([A|Z]),A#>0,A#<L,R#=C-1,T*B*L*R*[A|Z].
[]-[].
[X|T]-[Y|B]:-X*Y*L*L*[],T-B.
+A:-A-B,A/T,B/U,T-U.

Try it online!
The main predicate is +/1.
Verbose
t(A,B):-transpose(A,B).
h([],[],_,1,_).
h([0|T],[0|B],_,1,_):-h(T,B,L,L,[]).
h([1|T],[A|B],L,C,Z):-all_distinct([A|Z]),A#>0,A#<L,R#=C-1,h(T,B,L,R,[A|Z]).
q([],[]). q([X|T],[Y|B]):-h(X,Y,L,L,[]),q(T,B).
g(A):-q(A,B),t(A,T),t(B,U),q(T,U).

Try it online!
g/1 takes the grid as a list of lists, each element being a 1 for a cell or a 0 for a hole. q/2 takes a grid as the first argument and unifies the second argument with a solution of the grid. h(A,B,L,L,[]) takes a row of this grid as A, and unifies a solution for the row to B, and q/2 recursively calls h/5 on each of its rows.
h(A,B,L,C,Z) has row A of the grid, a solution B, L is the length of the current length of 1s plus one so that the cells of B can be constrained to the exclusive range (1, L), C is the count of the remaining length so that L is unified to the length, and Z is the solution for the current contiguous sequence of cells so that all_distinct/2 can be called. The end cases are stated as conditions so that these constraints are fulfilled.
Because this is Prolog, converting the main predicate to take two arguments, like A+B or g(A,B), Prolog will unify the solutions with the variable B, thus also allowing you to see all available solutions. It can also generate valid grids, but running this makes Prolog list all grids with empty rows.

R, 169 bytes
function(x)any(unlist(lapply(1:2,function(m)apply(apply(x,m,function(y,r=rle(y))rep(r$l*r$v,r$l)),1,function(a)tapply(a,cumsum(!a),function(d)sort(e<-d[!!d])<seq(e))))))

Try it online!
An R translation of my Jelly answer. I’m not sure it’s much easier to follow! Takes a matrix of 0s and 1s and returns a logical scalar (FALSE if Latin, TRUE if not). Note because of the way base R tends to collapse matrices to vectors, the input has to have at least 2 rows and columns, but this can be done by padding input with an extra row or column of FALSEs. If this is unacceptable, I can work around it at the cost of extra bytes to handle the edge case.


text:
Find all possible dates
You get a string which contains an integer between 1000 and 99999999 as input. The input string might contain leading zeroes but cannot be longer than 8 characters.
Your goal is to output all dates between 6th of December 1919 and 5th of December 2019 which fit the input in these formats:

day - month - year (dmy)
month - day -year (mdy)
year - month - day (ymd)

Days and months can be either one or two digits. Years can be either two or four digits. Also don't forget the leap years!

Your output dates must be all in the same format (choose one). Its days, months and years must be clearly distinguishable (choose a separator or encode them like YYYYMMDD).
You are free to leave any duplicate dates in your output (you're a good boy if you remove them though). If there are no dates to return, return nothing.
Examples:
Input:  "1234"
Output: 1934-02-01, 2012-03-04, 1934-01-02

Input:  "01234"
Output: 1934-01-02, 1934-02-01

Input:  "01211"
Output: 2001-11-01, 2011-01-01, 2001-01-11

Input:  "30288"
Output: 1988-02-03, 1988-02-30, 1988-03-02

Input:  "999999"
Output:

Shortest code in bytes wins. Have fun!

In your examples you have inputs with leading zeros. However you say that inputs are integers between 1000 and 99999999. Hence 1234 is equivalent to 01234. This needs clarified

Are there situations where a 7-digit integer leads to non-empty output?

@RobinRyder 2018111 should produce 2018-11-01,2018-01-11, if I'm understanding this challenge properly.

1988-02-30 doesn't look like a valid date.

How is 2001-11-01 a valid output for "01211"? How is 2001-02-11 not a valid output for "01211"?

Did you mean for the input to be "01111" for that example?

Ruby, 234 bytes
require'date'
a,b,g=%w(%Y%-m%d %Y%m%d %Y%-m%-d %Y%m%-d %-m%d%Y %m%d%Y %-m%-d%Y %m%-d%Y %d%-m%Y %d%m%Y %-d%-m%Y %-d%m%Y),Date.new(1920)-26,gets
(b..b+36524).map{|d|puts d.to_s if(a+a.map{|x|x.tr(?Y,?y)}).map{|x|d.strftime(x)}.member?g}

Try it online!
I'm willing to bet that this can be shortened this significantly (with regex maybe), but I'm not clever or knowledgable enough to figure that out.
If we are allowed to print the date object itself instead of a string, change puts d.to_s to p d.

The question has been closed now, but for future reference, [g]-array==[] is shorter than array.member?g by 1 byte, and is generally the shortest way to check if an element is in an array.

On the regex generation angle, I feel like this works pretty well, can probably be optimized further but already shaves a solid 40 bytes on its own (since you don't need the a+a.map part anymore): a=%w(Y y -m m -d d);a=a.product(a,a).map{|e|?%+e*?%}.grep /y.*m.*d|(d.*m|m.*d).*y/i

@ValueInk Thanks for the tips.


text:
How many atoms in the hydrocarbon?
How many atoms in the hydrocarbon?
A hydrocarbon is a chemical compound which consists of only hydrogen and carbon atoms. For this challenge, we will only consider the three simplest kinds of hydrocarbons: alkanes, alkenes, and alkynes with no branches.
An alkane with \$n\$ carbon atoms contains \$2n+2\$ hydrogen atoms. An alkene with \$n\$ carbon atoms contains \$2n\$ hydrogen atoms. An alkyne with \$n\$ carbon atoms contains \$2n-2\$ hydrogen atoms.
Each kind of hydrocarbon is named with a prefix indicating the number of carbon atoms it contains, followed by the suffix ane, ene, or yne if it is an alkane, alkene, or alkyne respectively. The numerical prefixes are as follows:
1  <-> meth
2  <-> eth
3  <-> prop
4  <-> but
5  <-> pent
6  <-> hex
7  <-> hept
8  <-> oct
9  <-> non
10 <-> dec

For example, we can see propane has 3 carbon and 8 hydrogen atoms, and heptyne has 7 carbon and 12 hydrogen atoms.
Challenge
Your task is to write a function or program that receives a string or list of characters representing the name of a hydrocarbon, and produces or outputs the number of carbon and hydrogen atoms in a molecule of that hydrocarbon.
For each of the 30 hydrocarbon names, the code must accept at least one possible capitalization of that name. For example, it is fine if your code works for mEthane but not methane, and ETHAnE but not ETHANE, and Propane but not propane. The inputs methene and methyne may give undefined output since those are not real chemicals.
The input and output can be in any convenient format. You don't need to label which number represents carbon and which represents hydrogen, just keep the order of the numbers consistent.
You may assume the input will correspond to a valid hydrocarbon, and there are at most 10 carbon atoms.
Examples
Possible Input -> Possible Output
Methane        -> 1 4
propane        -> 3 8
Heptyne        -> 7 12
Decene         -> 10 20

Rules

No standard loopholes.
Shortest code in bytes wins.

@Grimmy Yes, if it works for hexANe that is good enough. And it is reasonable to allow undefined behaviour for methene and methyne since they aren't real chemicals, though I wasn't expecting that to help anyone's solutions.

Wouldn't methyne just be pure carbon?

@Skyler As was pointed out in a now-deleted comment, the -yne suffix actually means the molecule has a triple bond between carbon atoms. Obviously a single carbon atom does not have a triple bond in it, so we don't call it methyne.

@Skyler Carbon isn’t a noble gas, so “pure carbon” isn’t a thing.

"the code must accept at least one possible capitalization of that name" <-- isn't this a loophole that allows you to just require the invoking user to encode the result in the case bits? Then you can say inputs that produce wrong outputs are just not the supported capitalization.

@R.. Is it a loophole if the author intended it to be possible? I wrote this challenge knowing one could store information in the capitalization. Not all languages are able to take advantage of this though.

@79037662: Well, it's not clear if it was intentional or not, but I think the problem is very different if that's allowed.

@Grimmy Something doesn't have to be a noble gas to be pure (e.g. "pure gold").

@Skyler Now you’re just switching up the meaning of “pure”. When you said methyne would just be pure carbon, you obviously meant something with molecular formula C, not something composed entirely of C (that would be graphene). Pure gold is like graphene in that regard.

ah, I see what you mean.

05AB1E,  27 26  24 bytes
Saved 1 byte thanks to @KevinCruijssen
Saved 2 bytes thanks to @Grimmy
Note: This code was based on my understanding that only the capitalization of the first letter was customizable. It has since been clarified that it applies to all letters, leading to this significantly shorter answer by Grimmy.
Expects mEpBPhHond for the capitalization of the first letter.
ćC•>·¿*•s÷θD>,₂I3(èH÷+·,

Try it online!
How?
We define the following magic constant:
$$M=1902159854$$
The number of carbon atoms is given by:
$$c=\left(\left\lfloor\frac{M}{n}\right\rfloor\bmod 10\right)+1$$
where \$n\$ is the first character of the input turned into an 05AB1E code point (0-9, A-Z, a-z, ...).
 input |  n  | floor(M/n) | mod 10
-------+-----+------------+--------
 meth- |  48 |   39628330 |   0
 Eth-  |  14 |  135868561 |   1
 prop- |  51 |   37297252 |   2
 But-  |  11 |  172923623 |   3
 Pent- |  25 |   76086394 |   4
 hex-  |  43 |   44236275 |   5
 Hept- |  17 |  111891756 |   6
 oct-  |  50 |   38043197 |   7
 non-  |  49 |   38819588 |   8
 dec-  |  39 |   48773329 |   9

Commented
                         # example input: 'Heptyne'
ć                        # extract the first character -> 'H'
 C                       # turn it into an integer -> 17
  •>·¿*•                 # push the magic constant 1902159854
        s÷               # swap + integer division -> 1902159854 / 17 = 111891756
          θ              # keep the last digit (therefore a modulo 10) -> 6
           D>            # duplicate and increment the copy
             ,           # print the number of carbon atoms
              ₂          # push 26
               I         # push the input string
                3(è      # extract the 3rd to last character -> 'y'
                   H     # parse it as base-36 -> 34
                    ÷    # integer division -> 26 / 34 = 0
                     +   # add to the number of carbon atoms - 1 -> 6
                      ·  # double
                       , # print the number of hydrogen atoms

I'm sure @Grimmy will come in and golf 5 bytes away, since he usually does that to my 05AB1E answers. ;) But here is a straightforward -1 byte for now: ¹ can be s (since the remainder-list from ć is still on the stack), and then the second Ç can be removed: 26 bytes.

-2 bytes. Note that there's no need to brute-force the magic constant, you can just use the chinese theorem.

My bad, the title of your answer says 05AB1E (legacy), but the 24 I suggested only works on modern 05AB1E due to my use of C and H. Here's a 23 that works on both modern and legacy: Ç•cýºÍ•s÷ćθ>=s3(è6%-Ì·, (expects MEpbPhHond capitalization).

05AB1E, 16 12 11 bytes
.uJ4ôCx<O1ǝ

Try it online!
This takes full advantage of the rule that only one possible capitilization has to be handled for each input. All inputs are at least 6 letters long, so we can store 6 bits of data in the capitilization. 4 of those bits are used to store the carbon count, and the remaining 2 store half of the extra hydrogen count (0 for alkynes, 1 for alkenes, 2 for alkanes).
.u             # uppercase? (returns a list of 0s and 1s)
  J            # join that list to a string
   4ô          # split in chunks of 4 digits
     C         # convert each chunk from binary
      x        # double each, without popping the original list
       <       # -1 from each
        O      # sum
         1ǝ    # replace the second element of the list with this sum

Alternative 11:
.u2β3‰<.¥¦ƶ

Try it online!

Perfectly acceptable.

Stupid rules deserve brilliant answers. ;)

R, 96 86 82 79 bytes
`!`=utf8ToInt;(5-rev(K<-!scan(,""))[3]%%16)/2*0:1+match(K[1],!"mepbPhHond")*1:2

Try it online!
Accepts the prefixes with capitalization mepbPhHond in order; returns c(Carbon, Hydrogen).
yea for this answer.
Thanks to Robin Ryder for golfing down 4 bytes.

yea this is the kind of answer I was looking forward to with the capitalization rule :)

82 bytes

@RobinRyder aahhh, I was too fixated on the match. I messed with the arithmetic as well to cut down three more bytes.

JavaScript (ES6), 62 bytes
Similarly to other answers, expects all names in lowercase, except Pent- and Hept-. Returns [carbon, hydrogen].
s=>[n='epbPhHond'.search(s[0])+2,n+/a/.test(s)-/y/.test(s)<<1]

Try it online!

JavaScript (ES6),  84  79 bytes
A version where the capitalization doesn't matter. Returns [carbon, hydrogen].
s=>[n=-~'519.80.76423'[parseInt(s[0]+s[2],28)%17],n+/a/.test(s)-/y/.test(s)<<1]

Try it online!
How?
Carbon
We can concatenate the first and third characters of each prefix to build a unique string identifier.
Example: meth → mt
We can convert this string ID to an integer ID in \$[0..11]\$ (still unique) by parsing it as base-28 and applying a modulo \$17\$ (these values were found with a brute-force search).
Because the character set of base-28 is '0' to 'r', the parsing stops if a character above 'r' is encountered.
Example: mt → m → \$22 \bmod 17=5\$
The results are summarized in the following table:
 input | key  | base 28 -> dec. | mod 17
-------+------+-----------------+--------
 meth- | 'm'  |        22       |    5
 eth-  | 'eh' |       409       |    1
 prop- | 'po' |       724       |   10
 but-  | 'b'  |        11       |   11
 pent- | 'pn' |       723       |    9
 hex-  | 'h'  |        17       |    0
 hept- | 'hp' |       501       |    8
 oct-  | 'o'  |        24       |    7
 non-  | 'nn' |       667       |    4
 dec-  | 'dc' |       376       |    2

Hydrogen
Neither 'a' nor 'y' appears in any of the prefixes. Therefore, it is safe to test whether the suffix is -ane or -yne by looking for these letters in the entire input string.
The following expression:
/a/.test(s) - /y/.test(s)

evaluates to either \$-1\$ for -yne, \$0\$ for -ene or \$1\$ for -ane.
Given the number \$n\$ of carbon atoms, the number of hydrogen atoms is:
(n + /a/.test(s) - /y/.test(s)) << 1

(and because << has a higher precedence than + and -, the parentheses can be omitted)

Hi Arnauld - would you mind adding some explanation - especially for the second version? I see that it works, but have no idea how (let alone how did you get there...)

@G0BLiN I've added an explanation of my original answer. Please let me know if something is still unclear.

Pyth, 33 31 bytes
Kx"mepbPhHond"hQhKy+K/%CePPQ7 3

Try it online!
Uses, as you can see, mepbPhHond capitalization. Probably can be golfed much further. Returns carbon, hydrogen on newlines
How it works
Kx"mepbPhHond"hQhKy+K/%CePPQ7 3

 x            hQ    - The index of the first letter of the input
  "mepbPhHond"      - in "mepnPhHond"
K               hK  - Assign to K... and then print K+1

                       CePPQ       - The codepoint of the third last character
                                       in the input (Q[:-1][:-1][-1])
                      /%     7 3    - Modulo 7 divided by 3 (ane, ene, yne -> 2, 1, 0)
                   +K               - ... plus K
                  y                 - ... times 2, and print implicitly

Python 3.8, 60 bytes
As other answers, all the names except for those starting with Prop- or Hept-, must be lowercase.
lambda x:(c:=' mePbphHond'.find(x[0]),c+'ea'.find(x[-3])<<1)

-4 bytes thanks to @Arnauld
Try it online!

Fun fact:
Another interesting fact I observerd is the following one:

\$ord(a)=97\to9-7=2\$ which is the number we have to add for alkanes.
\$ord(e)=101\to1-0-1=0\$ which is the number we have to add for alkenes.
\$ord(y)=121\to1-2-1=-2\$ which is the number we have to add for alkynes.

I don't think that I can modify my answer using this way to be less bytes thank it is right now, but I thought it was worth mentioning and maybe another answer can use it effectively!
An implementation of the above idea is the following one:
lambda x:(c:=' mePbphHond'.find(x[0]),2*c+reduce(lambda i,j:i-j,map(int,str(ord(x[-3])))))
from functools import reduce

which obviously is much more bytes (119).

60 bytes

@Arnauld Thanks! That's way more elegant :)

Python 2, 66 bytes
def f(s):n='mePbpHhond'.find(s[0]);return-~n,2*(n+ord(s[-3])%50%3)

Try it online!
Over thinking it a bit. Accepts only lower case, except for 'Prop' and 'Hept' (which must be capitalized). Returns (carbon, hydrogen).
Python 2, 84 82 bytes
def f(s):n=int('8702563914'[hash(s[:-3])%876%10]);return n+1,2*(n+ord(s[-3])%50%3)

Try it online!
Only accepts lower case.

-1 with %7/3

%11%5 works to give already-doubled values.

Ruby, 74 67 bytes
->s{z="  etthroutenexepctonec".index s[1,2];[z/2,z-2*(s[-3]<=>?e)]}

Try it online!
Thanks @Value Ink for golfing it for me. :-) -7 bytes

67 bytes using xnor's comment on the Python 2 solution.

Also you save 2 more bytes (1 if you use the old edit distance rules) by switching to -n mode.

Wolfram Language (Mathematica), 26 25 bytes
Tally@*AtomList@*Molecule

Thanks to att for the byte reduction.

Compose the functions Tally@*AtomList@*Molecule for -1

@att Thanks! In general, based on your suggestion, it seems when you have a single argument at the end, you don't need the @#&. But why use @* in this case, since you can simply do Tally@AtomList@Molecule for –3? I.e., both f@*g@*h@x andf@g@h@x give f[g[h[x]]]. I can see @* behaves differently from @ in cases when the latter would need to be followed by enclosing brackets, e.g. (adapted from Martin Ender's example in the MMA golfing tips ques.), Last@*Range /@ Range[5] works, but Last@Range /@ Range[5] doesn't....

...But you can do Last[Range /@ Range[5]] for the same no. of bytes as Last@*Range /@ Range[5]. I've not used @* before, so I'd be interested to see an example in which it saves bytes over@.

f@g@h is f[g[h]], which when applied on an argument x is obviously not what you want (f[g[h]][x]). It only works as intended when used as a snippet, inserting the input into the source code.

@att  I don't have a formal background in CS, so I spent time searching the internet to try to find a formal distinction between "snippet" and "function", and couldn't find one. Maybe this a question for  meta, but what's the formal defintion of "function" that this site uses which would explain why Tally@*AtomList@*Molecule qualifies as a function, while Tally@*AtomList@*Molecule does not?  Both seem to operate as stand-alone code that take input and return a value.  E.g.., compare Tally@*AtomList@*Molecule@"Heptane" and Tally@AtomList@Molecule@"Heptane"

Essentially, the distinction I'm trying to make here is that Tally@AtomList@Molecule requires an insertion into the source code in order to actually "work" properly: it only works if @(input) or [(input)] is appended to the code. As a standalone function, it doesn't fulfill its task: With[{f=Tally@AtomList@Molecule},f@(input)] yields Tally[AtomList[Molecule]][(input)], which is meaningless, whereas f=Tally@*AtomList@*Molecule behaves as expected.

@att. OK, thanks, I see how that disqualifies Tally@AtomList@Molecule.  But let me ask if Tally@*AtomList@*Molecule fully qualifies as a function. As I understand it, MMA functions that take one argument operate identically whether we use function@argument or function[argument].  But while Tally@*AtomList@*Molecule@"Heptane" works, Tally@*AtomList@*Molecule["Heptane"] doesn't (even though Molecule@"Heptane" === Molecule["Heptane"] returns True).  Note that this is not specific to this example, e.g., compare Reverse@*Sort@{a, c, b} and Reverse@*Sort[{a, c, b}]. Does this matter?

[] has higher precedence than @*//* - see this page. It's useful for composing operator forms (e.g. Last@*Position[0] finds the last position of a 0).

As I see it, a@*b[input] isn't applying a@*b to input; it's appending [input] to a@*b and evaluating the resulting expression.

Python 3, 83 bytes
x=input();n=list('_mepbPhHond').index(x[0]);print(n,2*n+{'a':2,'e':0,'y':-2}[x[-3]])

Try it online!
-51 bytes thanks to 79037662

Can save some bytes by only considering the first letter, instead of the first three: https://tio.run/##BcFBC4MgGAbgvxJdPl02wt2M7h13F4lGQsL2@lEOjOi32/PwkdYIXUoeAvifhOwxfMOeBE0/z5/3OkYsJJ8Bi88i287JnreAVEHpB5qTZjJakSfTKTrItPqy2bYv50qpeYs8w9c3

Charcoal, 39 bytes
≔⊘⁺³⌕”↶↓>AkQN!{a⁶⟧”…θ⁻Ｌθ⁵ηＩ⟦η⊗⁻⁺η№θa№θy

Try it online! Link is to verbose version of code. Takes input in lower case and outputs carbon and hydrogen atoms on separate lines. Explanation:
…θ⁻Ｌθ⁵

Remove the last 5 characters of the input.
⌕”↶↓>AkQN!{a⁶⟧”...

Search for the resulting prefix within the compressed string e prb peh heo n d. Note that there's a space before the e, so that the the prefixes are found at positions -1 for me(th?ne), 1 for e(th?ne), 3 for pr(op?ne) etc.
≔⊘⁺³...η

Add 3 to the position, then halve and store the resulting number of carbon atoms.
Ｉ⟦η

Output the carbon atoms...
⊗⁻⁺η№θa№θy

... and adjust for whether there is an a or y in the input, before doubling to give the number of hydrogen atoms.

C# (Visual C# Interactive Compiler), 65 bytes
x=>(l=" mepbPhHond".IndexOf(x[0]),~-l+x[x.Count-3]%7/3<<1);int l;

Try it online!

GolfScript, 32 30 bytes
Thanks to this user for pointing out that I forgot to account for -ane, -ene, -yne
.0="mepbPhHond"?).@-3=7%3/(+2*

Try it online!
This uses the same concept as in this answer
Explanation:
.0=                                 Make a copy of input and select first letter
   "mepbPhHond"?)                   Find index of letter and increase by one for number of carbons
                 .@                 Duplicate for number of hydrogens and bring input to top of stack
                   -3=              Get the a, e, or y in ane, ene, yne
                      7%3/          Ascii value mod 7 integer divide 3
                          (+        Decrement and add to number of carbons
                            2*      Double

Uses mepbPhHond capitalization.
Example Execution:
Input: propene
.0=                                 Stack: 'propene' 'p'
   "mepbPhHond"?)                   Stack: 'propene' 3
                 .@                 Stack: 3 3 'propene'
                   -3=              Stack: 3 3 'e'
                      7%3/          Stack: 3 3 1
                          (+        Stack: 3 3
                            2*      Stack: 3 6


text:
Morpion solitaire
Morpion solitaire
This is a game that I remember having learnt from my grandparents in my childhood. Initially I didn't know the name. G B has found it to be Join Five (or less ambiguously - Morpion solitaire) with a slightly different starting position.
NOTE: it seems that it's kinda known and this problem formulation has quite good solutions already (http://www.morpionsolitaire.com/English/RecordsGrids5T.htm). I don't know what to do with this thread now honestly.
Description
The game is played by a single player on a 2-dimensional infinite grid.
The grid at the start contains some dots in a cross shape:

A player can create either a horizontal, vertical, or a diagonal (or anti-diagonal) line with the following rules:

The line must be straight and aligned on the grid.
The line must span exactly 5 grid points (2 on the ends, 3 in the middle).
All 5 grid points that the line intersects must have dots on them.
The new line cannot overlap with an already existing line. But they can intersect and the ends can touch. (ie. intersection of any two lines must not be a line)
A single dot may be put by the player at any grid point before the line is placed. If the player does so then the line must pass through that point.

A move can be described by a grid point position (cartesian coordinates) and a direction (a number between 0 and 7. 0 - north, 1 - north east, 2 - east, and so on). So 3 numbers. The origin choice is arbitrary, but I suggest using this coordinate system: (An example of sample input at the end)

At the start there is 28 possible moves (12 horizontal, 12 vertical, 2 diagonal, 2 antidiagonal).
An example move:

An example state after 16 moves:

I don't know whether there exists an infinite sequence of valid moves from the start position, but I assume not based on a lot of playing and simulations. Any proofs regarding upper bounds are appreciated.
Challenge
The challenge is to find the longest possible sequence of valid moves (for a verifier look at the end). The score is the number of moves in that sequence. Higher score is better.
Tips, help, and resources
A 24x24 board was enough for my random simulations, 32x32 board may be enough for anything possible.
I faintly remember getting scores close to 100 by hand years ago.
After billions of random playouts (move uniformly chosen) the best result was 100 consecutive moves:
1 -1 2
1 2 2
1 6 0
-3 5 2
-2 5 0
-5 1 3
-2 -4 2
1 3 1
-5 -1 2
-5 0 1
-5 2 0
0 5 1
-2 0 0
1 -2 3
3 2 0
1 -1 0
-5 2 2
-5 -2 3
-3 3 0
4 3 0
-3 2 3
0 -4 3
-2 0 1
-3 -1 1
-3 -2 2
-1 -3 3
2 2 0
-3 0 1
1 2 1
1 -2 2
1 -5 3
-2 -3 2
1 -4 3
-1 0 0
-3 -2 3
5 2 0
-3 2 1
2 1 2
0 -1 0
0 -1 3
0 0 2
0 1 1
-4 0 2
-6 -2 3
-2 2 1
-2 1 2
0 2 1
-1 5 0
-4 6 1
-3 -3 3
-4 -2 3
-4 2 0
-6 1 2
0 3 0
-7 -2 2
-6 0 1
0 3 2
-7 -2 3
-4 3 2
-6 2 0
-6 1 3
-3 4 2
-3 6 1
1 5 1
-2 2 3
-3 7 0
2 6 0
-1 2 3
-7 3 1
2 5 1
3 6 0
-4 5 1
-3 7 1
-4 6 0
-6 2 3
-6 4 1
-7 3 3
-6 6 1
0 2 3
-6 6 2
-5 6 0
-7 4 2
1 6 2
-7 4 1
-8 3 2
-6 3 3
-6 6 0
-9 2 3
-7 5 2
-7 6 1
-7 6 0
1 2 3
-9 2 2
-9 4 1
1 5 2
1 1 3
4 7 0
1 4 2
5 6 0
1 7 1
Num moves: 100
Board:
                  o o
                  |/|\
              o-o-o-o-o
             /|/|/|X|X \
            o o-o-o-o-o o o
           / X|/|X|/|\ \ X
    o-o-o-o-o-o-o-o-o-o-o-o-o
     \|\|X|X X|X|/|X|X|X|X X|
      o o-o-o-o-o o o-o-o-o-o
      |X|X|X|X|X|X|X X|X|X|X|
      o o o-o-o-o-o-o-o-o-o o
      |/|X|X|X X X|X X|X|X| |
      o-o-o-o-o-o-o-o-o-o-o-o-o
     /|X|X|X|X|X|X|X X|X|/|X|/
o-o-o-o-o-o-o-o-o o o-o-o-o-o
 \ /|/|X|X|X|X|X|X|X|X|X|X|/|
  o-o-o-o-o-o-o-o-o-o-o-o-o o
 / \|X|X|X|X|X|X|X X|X|X|X|/|
o   o-o-o-o-o-o-o-o-o-o-o-o-o
    |\|X|X|X|X|X|X X|X|X|X|\|
    o-o-o-o-o-o-o-o-o-o-o-o-o
    |/|X|\|X|X /   \|\|X|\|\|
    o o-o-o-o-o     o-o-o-o-o
           \|X       /    |
            o o     o     o

Can you beat that?
C++17 helpful codes (hosted, because they don't fit in an answer, each on godbolt and coliru, you can use them however you like).:
clean, reference code, handles board, move generation, random playouts:
http://coliru.stacked-crooked.com/a/1de13a65522db030 https://godbolt.org/z/zrpfyU
optimized and parallelized version of the above (also prints move sequences), also with a verifier that takes moves from stdin:
http://coliru.stacked-crooked.com/a/b991b7c14aaf385e https://godbolt.org/z/vFwHUe
edit. an even more optimized version, about twice as fast:
https://godbolt.org/z/_BteMk
place where you can put input to be verified:
https://godbolt.org/z/DJtZBc
example input:
10        # number of moves
-6 2 2    # x, y, direction (0-7)
1 6 0
0 2 2
1 -1 0
1 -1 2
-5 1 3
4 2 0
-5 2 0
-3 -1 1
-2 5 2

Any proofs regarding upper bounds are appreciated. There exists no sequence of valid moves that can grow the outer boundary of the grid (that is, no infinite moves). You need 4 moves all into empty space in order to create a new 5th valid move, which must be strictly non-parallel to all of the previous 4. This new 5th move cannot generate any moves parallel to the first four, due to both being strictly non-parallel and the no-overlap rule.

@Draco18s I'm not sure I believe your last sentence "This new 5th move cannot generate any moves parallel to the first four, due to both being strictly non-parallel and the no-overlap rule."  If I am not misunderstanding either the question or your comment, but isn't this a counter example to your claim?

A simpler proof of the finiteness in my opinion is the following:  Each point can have up to four lines passing through it, (horizontal, vertical and two diagonal), we can call this line slots.  Drawing a line consumes one slot on 4 dots for a total of 4 slots and produces a dot which already has one of it's slots occupied.  Therefore every line reduces the total number of slots left by at least 1.  When there are less than 3 slots left no further lines can be drawn.  This gives an upper bound of 141 moves.

@WheatWizard The lines must be of length 4. The length of a line is defined by the grid, not by how many dots it spans.

@WheatWizard A point can be part of up to eight lines, if it is an endpoint for all of them. So assign 8 slots to each point, of which an inner line point uses two. A line with a new point which is an endpoint uses 7 slots and creates 7 new slots. A line with a new point that is an inner point uses 6 slots and creates 6 new ones. That's really tight!

@Sopel So how long is a diagonal line that passes through 5 total points (two end points and 3 intermediaries)? If it is "four" then the line is defined by how many dots its spanned. If it is "5.657" then it isn't length four and your own example image is wrong (and drawing a line of exactly length 4 would be impossible).

@Draco18s I found the rules unclear and wanted to add some condition ("if ... is allowed"), but then I saw that the 100 moves example from OP has such lines.

@ChristianSievers Re-reading the rule again, you are correct. It is, however, confusing.

@WheatWizard Draw a 4x4 grid of filled dots. Add four lines per Sopel's rules that create four new, colinear points outside the original 4x4 space. These four new points are create a new valid move. This new valid move can never be parallel to the first four lines. It does not matter how you arrange the initial dots and draw your first four lines such that their new points create a 5th move that uses no original dots, that 5th line cannot be parallel to all of the first four lines (you could get it to be parallel with 2, but such an arrangement does not extend the volume; it is interior).

You might want to rewrite "The line is always of length 4 (2 end points and 3 in the middle)." in a much clearer way, I took this to mean, "The line is always of length 4, which means ...", when it seems to be "The line is always of length 4, and ...".  Length 4 is also a confusing concept because under normal assumptions of length our diagonal lines are length $4\sqrt{2}$ (maybe this issue is why I looked to the parentheses for clarification).  It also might be worth specifically mentioning that parallel lines can intersect at their endpoints.

I clarified it, thanks. Ad. the second part. There is already "But they can intersect and have a common point.", but I'll clarify it more.

Ad. closing vote. I don't see how it is different from, say, https://codegolf.stackexchange.com/questions/53310/shortest-universal-maze-exit-string.

The game is Join Five also known as the Morpion Solitaire. It's been studied a lot, the current best is 178 moves.

@GB yes that looks like it! The start position is different but the rules match. I have to ask my grandparents when they first encountered it because 1970 is not very old.

Actually, I could probably make it into a different kind of challenge, with varying initial boards if this doesn't gain traction, seeing that the version with the filled cross apparently has upper bounds proven.

According to http://martindemaine.org/papers/Morpion_TheoryComputSys/paper.pdf the upper bound is 141 moves for the version without allowing touching lines. That matches exactly the simple explanation by @WheatWizard ! But the version with allowing touching lines (the one here) has a much higher upper bound proven there - 704.

Best known is 170, or maybe even higher. So this thread may not be very interesting...

Best known for 5T is 178, for 5D (the variant in this question) is 82

the variant in this question explicitly allows touching lines

You are right, sorry. I looked at the picture and I got it wrong.


text:
Round up my number
Sandbox
Given two positive integers a and b, return the smallest multiple of b that is greater than or equal to a.
Examples
Definitions: true = is a multiple of b, false = is not a multiple of b.

f(1,3) = 3 because 1 is false, 1+1 is false, but 1+1+1 is true. Therefore 3 is returned.
f(5,3) = 6 because 5 is false, but 5+1 is true. Therefore 6 is returned.
f(9,3) = 9 because 9 is already a multiple of 3.
f(12,5) = 15 because 12 is false, 12+1 is false, 12+2 is false, but 12+3 is true. Therefore 15 is returned.

Rules

Input/output can be given by any convenient method.
You can print it to STDOUT or return it as a function result.
Either a full program or a function are acceptable.
Any amount of extraneous whitespace is permitted, provided the characters line up appropriately.
Standard loopholes are forbidden.
This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.

The Catalogue
The Stack Snippet at the bottom of this post generates the catalogue from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
## Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:
## Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:
## Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the snippet:
## [><>](https://esolangs.org/wiki/Fish), 121 bytes

/* Configuration */

var QUESTION_ID = 196683; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 8478; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];

  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '
' + c.body.replace(OVERRIDE_REG, '') + '
';
    });

    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });
    else console.log(body);
  });

  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;

    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    lang = jQuery(''+lang+'').text();

    languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang, user: a.user, size: a.size, link: a.link};
  });

  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);

  langs.sort(function (a, b) {
    if (a.lang_raw.toLowerCase() > b.lang_raw.toLowerCase()) return 1;
    if (a.lang_raw.toLowerCase() < b.lang_raw.toLowerCase()) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}
body {
  text-align: left !important;
  display: block !important;
}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 500px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}

<link rel="stylesheet" type="text/css" href="https://cdn.sstatic.net/Sites/codegolf/all.css?v=ffb5d0584c5f">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

I think from your wording it is not so clear what actually should be returned. I'd just rephrase the challenge to something like "Given two positive integers a and b, return the smallest number that is at least as big as a which is also a multiple of b."

Python, 17 bytes
lambda a,b:a+-a%b

Try it online!
Since this doesn't use division, it works for both Python 2 and 3. Note that we can't cut out the + sign because a-a%b does a-(a%b), whereas we want to do(-a)%b and add that to a. We could also write it as -a%b+a.

Japt, 2 bytes
cV

Try it
cV     :Implicit input of integers U & V
cV     :Round U up to the nearest multiple of V

With input as an array:
rc

Try it
rc     :Implicit input of array
r      :Reduce by
 c     :Rounding the first element up to the nearest multiple of the second

Less Trivial!, 6 bytes
_vV}aU

Try it
_vV}aU     :Implicit input of integers U & V
_          :Function taking an integer Z as input
 vV        :  Is Z divisible by V?
   }       :End function
    aU     :Starting from U, return the first integer that returns true when passed through that function

ôV ævV

Try it
ôV ævV     :Implicit input of integers U & V
ôV         :Range [U,U+V]
   æ       :Get first element
    vV     :  Divisible by V

Your description bascially repeats the task. I don't know japt, is it possible to describe what each character does?

@findusl, "full" explanation added!

Intcode (day 5), 70 66 64 bytes
3,0,3,2,102,-1,2,4,1,0,4,0,1,1,8,1,7,9,0,5,5,5,14,2,1,2,0,4,0,99

Try it online!
Intcode is a programming language invented for Advent of Code 2019. It was first introduced on day 2, then further expanded upon on day 5, which is the version used here.
Since on PPCG, languages are defined by their interpreters, I am using the interpreter that I wrote for my day 5 solution (which was written before this challenge).
Explanation:
3,0,          store first input in cell 0
3,2,          store second input in cell 2
              (cell 1 is a counter, because it's already initialized to zero)
102,-1,2,4,   negate the second input and store in cell 4

              (begin loop)
1,0,4,0,      subtract the second input from the first input
1,1,8,1,      increment the counter (by adding cell 8)
7,9,0,5,      if the first input is greater than zero (cell 9)...
5,5,14,       ... jump to the beginning of the loop (reusing the cell 8 reference)

2,1,2,0,      multiply the counter by the second input
4,0,99        output and quit

MATL, 4 bytes
:ien

Try it online!
Explanation
Consider inputs 12, 5.
     % Implicit input
:    % Range
     % STACK: [1 2 3 4 5 6 7 8 9 10 11 12]
i    % Input
     % STACK: [1 2 3 4 5 6 7 8 9 10 11 12], 5
e    % Reshape as a matrix with that number of rows, padding with zeros
     % STACK: [1  6 11;
               2  7 12;
               3  8  0;
               4  9  0;
               5 10  0]
n    % Number of elements
     % STACK: 15
     % Implicit display

Shouldn't the stack after Range be [1 2 3 4 5 6 7 8 9 10 11 12] ?

@Galen Yes, thank you! Corrected

x86 Machine Code, 7 bytes
Since x86 integer division instructions do only floor rounding, this uses the formula: f(a,b) = floor((a+b-1)/b)*b to accomplish ceiling rounding.
02 C3   ADD  AL, BL     ; a = a + b
48      DEC  AX         ; a = a - 1
F6 F3   DIV  BL         ; a = a / b
F6 E3   MUL  BL         ; a = a * b

Input is in AL and BL, output is AL.
Testing
Here is output from a test program for PC DOS that takes interactive input.

Download and test ROUNDMY.COM.

Octave, 17 bytes
Same method as this JS answer:
@(a,b)ceil(a/b)*b

Try it online!

JavaScript (Node.js), 17 bytes
a=>b=>a+(b-a%b)%b

Try it online!

-1 byte by Neil

a-(a%b||b)+b=b-(a%b||b)+a=(b-a%b)%b+a to save a byte.

Wasn't enough though, someone's come up with a 15-byter!

Python 2, 23 20 18 bytes
lambda a,b:-a/b*-b

Try it online!
2 bytes thanks to tsh

My guess is that is not necessary as Python 2 division (/) actually returns an integer itself. And in Python 3 you can directly use // as a floor division. Both of wich are more compact expressions.

a/-b*-b also works, and is slightly more readable, I think?

@Neil - Readability?!? Blasphemy! :)

Haskell, 14 bytes
a%b=a+mod(-a)b

Try it online!

C++ (gcc), 43 41 40 36 25 bytes
#define f(a,b)(b-a%b)%b+a

Try it online!
Saved 4 bytes thanks to @Neil!!!
Saved 11 bytes thanks to @AZTECCO!!!

-4 bytes: (b-a%b)%b+a

@Neil Thanks so much - absolutely brilliant!

25 using #macro

@Neil the same solution I suggested here https://codegolf.stackexchange.com/a/196710/84844 in the last comment, which is basically a port of xnor solution

@AZTECCO Wow! I was assuming we're  stuck with the first run of bytes as the shortest possible in C++ but you came up with a way forwards!

Nice to help! I came up with that formula for the purpose of leaving the expensive 'return' keyword, see my comment on the C answer, the same is also achievable in c++ only with #macro, a bit more expensive though

Jelly, 3 bytes
÷Ċ×

Try it online!
Simply divide, ceiling, multiply.

C (gcc), 47 31 25 bytes
f(a,b){a=a%b?f(++a,b):a;}

Try it online!
-16 bytes thanks to A̲̲ (forgot that return types and parameters would default to int if not defined, whoops!)
-6 thanks to AZTECCO for using a ternary and making the function recursive

You can save 1 with ternary Try it online!

25

Try it online! using Tcc and a different approach

Wolfram Language (Mathematica), 7 bytes
Ceiling

Just pointing out that Mathematica's builtin, which is most commonly called with one argument, actually does exactly the desired operation when called with two arguments.

Brainfuck, 52 49 bytes
Thanks to Jo King for finding a bug, helping fix it with some extra golfing.
,>>,<<[>+>->+<[>]>[<+>-]<<[<]>-]>>>[<[-<+>]>,]<<.

Input and output is in character codes.
Try it online!
Explanation
,>>,<<                     [>a, 0,     b,   0]
[>+>->+<[>]>[<+>-]<<[<]>-] [>0, a, b-a%b, a%b]
>>>[<[-<+>]>,]             If a%b is nonzero, add b-a%b to a, and clear a%b
<<.                        Output a+(b-a%b)

Modulus algorithm is straight from the esolang list of brainfuck algorithms.

Welcome to the site!

Yikes. Yeah, somehow it slipped my mind "outputting a null won't matter" when I'm using character codes. Will update the code to your version.

Okay listen, just 'cause you're right...

JavaScript (V8), 22 bytes
This is the function \$(a,b) \mapsto \left\lceil \frac{a}{b} \right\rceil b\$.
a=>b=>Math.ceil(a/b)*b

Try it online!

R, 20 bytes
function(a,b)a+-a%%b

Try it online!

K (oK), 8 bytes
{x+y!-x}

Try it online!
Another port of xnor's Python answer.

Vyxal, 3 bytes
/⌈*

Try it Online!

Red, 31 bytes
func[a b][round/to/ceiling a b]

Try it online!
Just a built-in round with refinements to, which scales the first argument according to the second, and ceiling, which indicates the direction.
Red, 25 bytes
func[a b][0 - a // b + a]

Try it online!
A port of xnor's Python answer. Don't forget to upvote his answer!

Retina 0.8.2, 28 bytes
\d+
$*
r`1+(\2*) (1+)
$1$2
1

Try it online! Link includes test cases. Explanation:
\d+
$*

Convert the inputs to unary.
r`

Process this stage from right-to-left, so that \2 gets to match \$ b \$ first, allowing us to refer to it when matching within \$ a \$.
1+(\2*) (1+)

Match \$ b \$ in \2, then as many copies of \$ b \$ as we can, without completely exhausting \$ a \$. \1 thus matches \$ b \lfloor \frac {a - 1} b \rfloor = b \lceil \frac {a - b} b \rceil \$
$1$2

Add that to \$ b \$ to give \$ b \lceil \frac a b \rceil \$.
1

Convert to decimal.

Ruby, 13 bytes
->a,b{-a%b+a}

Try it online!

Prolog (SWI) + CLPFD, 30 bytes
f(R,X,Y):-R#=_*Y,R-Y#<X,R#>=X.

Try it online!
f(R,X,Y)

f is a predicate taking in a variable R, and two integers X and Y.
The CLPFD constraints are expressed using the #-prefixed operators. , means and, so f is true iff all these constraints are satisfied, i.e.,
1) R#=_*Y R is a multiple of Y , and
2) R-Y#<X R-Y < X , and
3) R#>=X R >= X .

SimpleTemplate, 61 bytes
This was quite fun! Sadly, I had to do the dumb way :(
{@fn F A,B}{@whileA is notmultipleB}{@incA}{@/}{@returnA}{@/}

Creates a function that iterates until it finds a number that's multiple of the 2nd number.
This was actually way smaller than doing it without a function.

Ungolfed:
{@fn F numberA, numberB}
    {@while numberA is not multiple of numberB}
        {@inc by 1 numberA}
    {@/}
    {@return numberA}
{@/}

Should be mostly straightforward.
You can see it running on https://ideone.com/MR7t1E (golfed version only).

Glad you enjoyed it! I find simple challenges seem to capture folks' imaginations and are more likely to take off than something overcomplicated. --AJFaraday

Charcoal, 10 bytes
≔±ＮθＩ×θ÷Ｎθ

Try it online! Link is to verbose version of code. Takes \$ b \$ first and \$ a \$ second. Explanation:
≔±Ｎθ

Input \$ b \$, negate it, and save the result.
Ｉ×θ÷Ｎθ

Input \$ a \$ and compute \$ -b \lfloor \frac a {-b} \rfloor \$, then cast to string for implicit print.

For those of you counting, this was my 3000ᵗʰ answer!

GolfScript, 6 bytes
.~)@%+

Try it online!
Function which consumes A and B from the stack, assuming B is below A.
Explanation:
           #Example input: A = 12, B = 5          stack is  5  12
.~)        #Duplicate A and negate the duplicate  stack is  5  12 -12
   @       #Pull 3rd from top to top              stack is 12 -12   5
    %      #Second to top mod top                 stack is 12 3
     +     #Add remaining values                  stack is 15

Javascript (ES6), 19 bytes
a=>b=>a%b?a-a%b+b:a

Naive attempt, pretty sure this can be golfed further.

Java, 99 bytes
static int r(int a,int b){int t=a%b<1||b%a<1?a:r(a+1,b);return t;}

JavaScript, 15 bytes
a=>b=>--a+b-a%b

More expressively, the answer is a => b => a + b-((a-1)%b) - 1, but by decrementing a we can handle both the "subtract one" steps at once, saving a couple of bytes. Then we just get lucky with operator presidencies.

Java (JDK), 15 bytes
b->a->--a+b-a%b

Try it online!

Perl 5, (111 bytes with footer) 52 bytes
sub f{($a,$b)=@_;$c=$b;$c++until!($c%$b)&&$c>=$a;$c}
Try it online!
Takes a and b as arguments to a subroutine named f and increases $c until it is both a multiple of $b and greater than or equal to $a. Then returns $c (the last value evaluated in a subroutine is the return value).

Thunno 2, 3 bytes
/ṃ×

Try it online!
Explanation
/ṃ×  # Implicit input
/    # Divide
 ṃ   # Ceil
  ×  # Multiply
     # Implicit output

J, 6 bytes
]*>.@%

Try it online!
]         the right argument
 *        multiplied by
  >.@     the ceiling of
     %    the left argument dividided by the right one

If we can swap the order of the aruments:
J, 5 bytes
]+[|-

Try it online!

Pyth, 8 bytes
AQ+G%_GH

Try it online!
Simple port of the Python answer from xnor so please give that answer an upvote.
Debugged:
==================================================
assign('Q',eval_input())
assign('[G,H]',Q)
imp_print(plus(G,mod(neg(G),H)))
==================================================

-3 with a more direct port

@frank - Nice. Different enough for you to post as your own if you want to. I'm still a beginner with Pyth. A lot to learn :)

Keg, -hr, 17 9 6 bytes
¿±¿%¿+

A port of my W answer which is a port of Xnor's python answer
Answer History
9 bytes -rR
&¿{:⑻$%|⑹

Explained
&¿{:⑻$%|⑹
&           #Store the implicit input (the number to round) in the register
 ¿          #Take the number to 'round by'
  {         #While:
   :⑻      #Duplicate the 'round by' and push the register without emptying it
     $%  #Swap the two and perform modulus, checking the result against 0
       |⑹  #    Increment the register

Answer History
17 bytes
&¿{:&:&$%|&1+&}&

Try it online!

APL+WIN, 8 bytes
Prompts for b followed by a:
b×⌈⎕÷b←⎕

Try it online! Courtesy of Dyalog Classic

MathGolf, 3 bytes
/ü*

Similar approach as other answers: \$\lceil\frac{a}{b}\rceil b\$.
I/O as floats with .0, with the inputs in the order a b.
Try it online.
Explanation:
/    # Divide the second (implicit) input by the first (implicit) input
     #  i.e. 3.0 5.0 → 1.666...
 ü   # Ceil it
     #  → 2
  *  # Multiply it by the first (implicit) input
     #  → 6.0
     # (output the entire stack joined together implicitly as result)

Runic Enchantments, 10 bytes
ii:},'cA*@

Try it online!
ii            Read a, read b
  :}          Dup b, rotate to bottom of stack
    ,         Divide
     'cA      Ceiling
        *     Multiply
         @    Output and terminate

W, 7 4 bytes
_bm+

-3 bytes thanks to @A
Answer History
0a-bma+

Yet another port of xnor's Python answer.

0S-bm+ for -1 byte

_bm+ for -3 bytes, but might be cheating because it is created after this challenge.

TI BASIC, 8 bytes
-Bint(-A/B

"-" is the negative symbol here, distinct from the minus symbol on the calculator.  TI BASIC doesn't have a token for a rounding up operation, we have to pick between iPart( and int( or take another route with fPart( or remainder( on OS 2.53+.  int( rounds -2.5 down to -3 where iPart( would return -2, so we can use int( with negation to turn rounding down into rounding up.
Disp is implicit because the result is the final line, and the function can be a full program easily by adding Prompt A,B.

Pyth, 5 bytes
+%_QE

Try it online!
Port of @xnor's answer
How it works
+%_QE
+    (Q)- The sum of the implicit first input and...
  _Q    - The negative of the first input...
 %  E   - Modulo the second input

Rockstar, 115 109 bytes
F takes X
let M be X/D
turn up M
return M is X/D

listen to N
listen to D
until F taking N
let N be--1

say N

Try it here (Code will need to be pasted in, input on individual lines)

Perl 5 -p, 10 bytes
$_+=-$_%<>

Try it online!

Nekomata, 3 bytes
/K*

Attempt This Online!
\div, \ceil, \mul.

ARBLE, 11 bytes
ceil(a/b)*b

Try it online!