[Question]
      [
Most tip calculator apps simply take a flat percentage of the meal price. So, for example, if your meal is $23.45, you can leave a 15% tip = $3.52, or a more generous 20% tip = $4.69.
Convenient enough for credit card users. But not so if you prefer to leave cash tips, in which case these oddball cent amounts get in the way. So let's modify the idea to be more convenient for cash users.
## Your assignment
Write, in as few bytes as possible, **[a program or function](https://codegolf.meta.stackexchange.com/questions/2419/default-for-code-golf-program-function-or-snippet)** that takes as input:
* Price of the meal
* Minimum tip percentage
* Maximum tip percentage
And output any tip amount within the range [price \* min\_percentage / 100, price \* max\_percentage / 100] that minimizes the number of bills/banknotes and coins required.
Assume the US monetary denominations of 1¢, 5¢, 10¢, 25¢, $1, $5, $10, $20, $50, and $100.
## Example
Here is a non-golfed example program in Python:
```
import math
import sys
# Do the math in cents so we can use integer arithmetic
DENOMINATIONS = [10000, 5000, 2000, 1000, 500, 100, 25, 10, 5, 1]
def count_bills_and_coins(amount_cents):
    # Use the Greedy method, which works on this set of denominations.
    result = 0
    for denomination in DENOMINATIONS:
        num_coins, amount_cents = divmod(amount_cents, denomination)
        result += num_coins
    return result
def optimize_tip(meal_price, min_tip_percent, max_tip_percent):
    min_tip_cents = int(math.ceil(meal_price * min_tip_percent))
    max_tip_cents = int(math.floor(meal_price * max_tip_percent))
    best_tip_cents = None
    best_coins = float('inf')
    for tip_cents in range(min_tip_cents, max_tip_cents + 1):
        num_coins = count_bills_and_coins(tip_cents)
        if num_coins < best_coins:
            best_tip_cents = tip_cents
            best_coins = num_coins
    return best_tip_cents / 100.0
# Get inputs from command-line
meal_price = float(sys.argv[1])
min_tip_percent = float(sys.argv[2])
max_tip_percent = float(sys.argv[3])
print('{:.2f}'.format(optimize_tip(meal_price, min_tip_percent, max_tip_percent)))
```
Some sample input and output:
```
~$ python tipcalc.py 23.45 15 20
4.00
~$ python tipcalc.py 23.45 15 17
3.55
~$ python tipcalc.py 59.99 15 25
10.00
~$ python tipcalc.py 8.00 13 20
1.05
```

[Answer]
# JavaScript (ES6), 93 bytes
```
(x,m,M)=>(g=(t,c=1e4)=>t>x*M?0:t<x*m?[...'1343397439'].some(d=>g(t+(c/=-~d/2)))*r:r=t)(0)/100
```
[Try it online!](https://tio.run/##dcxBDoIwFATQvadg5y@WT0tLsMTCCTiBcUGgEA1QA41h5dUrie6Ii1lMXmYe9atemvn@dNFkW@M77WGlI62ILqDX4GijuZFbc8UaViXL3WUNx/KKiEcupBAqk0Idb7jY0UCrix7cCZpYR@82Tggh4ZzP2hFgJOaM@cZOix0MDraHDhKBMqUB35IwQg5/lWc7TRUq9dumOw3OyNim4vvsPw "JavaScript (Node.js) – Try It Online")
### How?
We recursively compute a sum of bill/coin values until it falls within the acceptable range, always trying the highest value first.
This is guaranteed to use the minimum amount of bills and coins because for any solution \$\{b\_0,\dots,b\_n\}\$ returned by this algorithm:
* all terms \$b\_0\$ to \$b\_n\$ are required, otherwise the algorithm would have selected \$\{b\_0,\dots,b\_{k-1},x\}\$ with \$x \ge b\_k\$ for some \$0 \le k < n\$
* for any \$0 \le k < n\$ and any \$x \le b\_n\$, \$\{b\_0,\dots,b\_{k-1},b\_k-x,b\_{k+1},\dots,b\_n\}\$ cannot be a solution, otherwise \$\{b\_0,\dots,b\_{n-1}\}\$ would have been selected
* there may exist some \$0 < x < b\_n\$ such that \$\{b\_0,\dots,b\_{n-1},x\}\$ is also valid, but that would not use less bills/coins than the selected solution
The bill/coin values \$c\_n\$ expressed in cents are computed with:
$$\begin{cases}c\_0=10000\\c\_{n+1}=\dfrac{c\_n}{(d\_n+1)/2}\end{cases}$$
where \$(d\_0,\dots,d\_9) = (1,3,4,3,3,9,7,4,3,9)\$.
```
 n | c(n)  | d(n) | k = (d(n)+1)/2 | c(n+1) = c(n)/k
---+-------+------+----------------+-----------------
 0 | 10000 |   1  | (1+1)/2 = 1    |      10000
 1 | 10000 |   3  | (3+1)/2 = 2    |       5000
 2 |  5000 |   4  | (4+1)/2 = 2.5  |       2000
 3 |  2000 |   3  | (3+1)/2 = 2    |       1000
 4 |  1000 |   3  | (3+1)/2 = 2    |        500
 5 |   500 |   9  | (9+1)/2 = 5    |        100
 6 |   100 |   7  | (7+1)/2 = 4    |         25
 7 |    25 |   4  | (4+1)/2 = 2.5  |         10
 8 |    10 |   3  | (3+1)/2 = 2    |          5
 9 |     5 |   9  | (9+1)/2 = 5    |          1
```
[Answer]
# Python 3.x: ~~266~~ 185 bytes
A straightforward modification to my example program in the question. Note that the output is no longer formatted to require 2 decimal places.
**Edit:** Thanks to Jo King for making it smaller.
```
import sys
p,m,M,T=*map(float,sys.argv[1:]),0
C=p*M
for t in range(-int(-p*m),int(p*M)+1):
 n,a=0,t
 for d in 1e4,5e3,2e3,1e3,500,100,25,10,5,1:n+=a//d;a%=d
 if n<C:T,C=t,n
print(T/100)
```
[Answer]
# Java 10, ~~186~~ 185 bytes
```
(p,m,M)->{double r=0,t,Q=99,q;for(m*=p+.02;m<M*p;m+=.01){q=0;t=m;for(var c:new double[]{100,50,20,10,5,1,.25,.1,.05,.01})for(;t>=c;t-=c)q++;if(q<Q){Q=q;r=m;}}return"".format("%.2f",r);}
```
Takes the minimum and maximum percentages as `/100` decimals (i.e. `15%` as `0.15`).
-1 byte to fix the issue with `3.51` as potential output and golfing the way to fix rounding errors by 1 byte at the same time.
[Try it online.](https://tio.run/##lVJNb9wgEL33V4xWqgRZloA3brol5NbjRlr1GOVAMU5IF2zj8aaV5d@@ZT@qSlHVKBIwM5rHY94Mz2ZnFs/Vj73dmr6HtfFx/ADgI7pUG@vg7hACfMPk4yNYUjXD962Dlp2d8MdZU5WRU9559WjQW7iDCHpPWhbYmi5uxzM0acGQbfRqxTpVN4mEC93OuShUuFlftCrMNReSjp0WCnU4QnYmgf0S3QucSO4fRikEKwUrBJPZYZLxomQ8G5GNkBM93FN4q63Chba0m8@Vr0l3s6HjRncqZeppSg6HFGczntHBIJl95EU9Y4mqaa9Oatr8YFZzFrVrfAUhN4qcmnL/AIaeu/SrRxd4MyBvcwq3kURuSbHkVyUDweXxLASlCi4v4evP1ll0FVxxId5BIK9fEyx5WQJZ8k8CmpSj6xKG3gE@OehNcGBCM0SEpgbb@NiDiRWY5ODF45OPR1wy8dHR/1VRrnie2F8Z5esqpHhDx@ecZ3BgWP67ETLP7viLpv1v)
**Explanation:**
```
(p,m,M)->{                // Method with three double parameters and String return-type
  double r=0,             //  Result-double, starting at 0
         t,               //  Temp-double
         Q=99,            //  Min amount of coins, starting at 99
         q;               //  Temp-double for the amount of coins
  for(m*=p-.02;m<M*p;     //  Loop in the range [`m*p-0.02`, `M*p`]
           m+=.01){       //  in steps of 0.01 (1 cent) per iteration
                          //  (the -0.02 (minus 2 cents) is to fix rounding errors)
    q=0;                  //   Reset `q` to 0
    t=m;                  //   Reset `t` to the current iteration `m`
    for(var c:new double[]{100,50,20,10,5,1,.25,.1,.05,.01})
                          //   Loop over the coins (largest to smallest)
      for(;t>=c;          //    As long as `t` is larger than or equal to the current coin
          t-=c)           //     Remove the coin from the value `t`
          q++;            //     And increase the quantity-counter by 1
      if(q<Q){            //   If the quantity-counter is smaller than the current smallest
        Q=q;              //    Replace the smallest with the current
        r=m;}}            //    And replace the result with the current `m`
  return"".format("%.2f",r)l;}
                          //  Return the result with 2 decimal places
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 60 bytes
```
Ｎθ≔×θＮη≔×θＮζ≔⁰θＦＩ⪪”;‴üφ↷Σ↗SEX&¿h'⊟”³«Ｗ‹θη≧⁺ιθ¿›θζ≧⁻ιθ»﹪%.2fθ
```
[Try it online!](https://tio.run/##jU/BagIxED27XzEsFCaQhuzapQdPpYdSqCLaH0g1awbi7ppkW7D022OihwpePAzDe/PmvZmNUW7TKxvjezeMYTHuv7TDA5sVL97TrsNP2muPBw7Xc8Y4mDs0x3@N5JBd297hq/IB14OlgGUlZSNFLUUlRSNkJRJIROoZlRymjDH4LSY/hqwG/ND@nGQSO1fDxXxFOxNwaUfPgS45E2oB35xWIb@TL7nRz6m7Wvgrlo66xPbb0fZYPoi6LfOIzWKsp@KpAVHleo6P3/YE "Charcoal – Try It Online") Takes input as decimals. Link is to verbose version of code. Explanation:
```
Ｎθ
```
Input the bill.
```
≔×θＮη≔×θＮζ
```
Input the tip decimal fractions and compute the minium and maximum tip.
```
≔⁰θ
```
Start with zero tip.
```
ＦＩ⪪”;‴üφ↷Σ↗SEX&¿h'⊟”³«
```
The SEXy string expands to `10050.20.10.5.01.0.250.1.05.01` which is split into groups of three characters and cast to float.
```
Ｗ‹θη≧⁺ιθ
```
Add as many of the current denomination as necessary to reach the minimum tip.
```
¿›θζ≧⁻ιθ»
```
Remove one denomination if the maximum tip has been exceeded.
```
﹪%.2fθ
```
Format the tip for display.
[Answer]
# [Clean](https://github.com/Ourous/curated-clean-linux), ~~207~~ 156 bytes
Swapping to a function saved 51 bytes, unsurprisingly.
```
import StdEnv
d=[10000,2000,1000,500,100,25,10,5,1]
$n u l=snd(hd(sort[(sum[foldl(rem)m(d%(0,i))/k\\k<-d&i<-[-1..]],toReal m)\\m<-map toInt[n*u..n*l]]))/1E2
```
[Try it online!](https://tio.run/##JY6xjgIhFEV7v4JCN4wBlkGnm@nWwmSrtWQoyDAqkfcwwpj488ti9hbnnuYmdwqzxQLRLWEmYD0WD/f4yOSU3QGfKzfoVtYw9cZbWfcvTHW1WIVZrZEsJAwJHb06mupe07SAPsfgAn3M0AB1GyqZb5rP2zjeeu4@fM81b4UwhuX4M9tAoBlH6DnYO8nxiFnjdhECt8GYumsPqpyyrd8GslY7se9I2wlJlBSy/E7nYC@p8ON3@XqhBT@lPw "Clean – Try It Online")
[Answer]
# Python (~~264~~ 222 bytes)
Slightly more golfed.
```
m=[.01,.05,.1,.25,.5,1,5,10,20,50,100]
def f(a,i,j):
 t,u=9**9,a*j
 def g(s,d,c):
  nonlocal t
  if(a*i<s<u)+(c>t):t=min(c,t);return c,s
  return(t+1,s)if(s>u)+(d>9)else min(g(s+m[d],d,c+1),g(s,d+1,c))
 return g(0,0,0)[1]
```
[Try it Online!](https://tio.run/##bY7BboQgEIbvPAVHRicEtKRlu/oixoNBbdkobgQPfXo7tJtmDw2BYfLNx8/9K31uoT7Ptemk0iiVQUmlomJQI22FlUKj6KJ6Nk4zn8WAHm9wYTzh0diisDgUN8Yz/BARR3QZ8rCFZXPDwhM1nrTCX@P1gFK4NsElNasPwmGC931Kxx64w0iTv41IpcYIpMU2K2NrYVrixLNEKeXajX2OKjXgTyrNOwD28OknCmlBp3t23ncfEhezqGr5YpBLnY9K0fz/SL8@I2OltX@WeUZvUqlM6sd75zc)
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), ~~93 92~~ 89 bytes
```
{.01*($^a*$^b+|0...$a*$^c).min:{$!=$_;sum '✐ᎈߐϨǴd
'.ords>>.&{($!%=$_)xx$!/$_}}}
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYKvwv1rPwFBLQyUuUUslLkm7xkBPT08FxE7W1MvNzLOqVlG0VYm3Li7NVVB/NGfCw76O@xPOrzi@JUWSi5VRXS@/KKXYzk5PrVpDRVEVqFCzokJFUV8lvra29n9xYqVCmoaRsZ6JqY6hqY6RgaY1F5qYoTlczNRSz9ISrM4ULmahZ2CgY2gM1vofAA "Perl 6 – Try It Online")
Anonymous code block that takes three arguments (price, minimum percentage, and maximum percentage) and returns the tip.
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 105 bytes
This will give all the solutions with minimal coin count.
```
MinimalBy[NumberDecompose[#,d=100{100,50,20,10,5,1,.25,.10,.05,.01}]&/@Range[Ceiling[#2#],#3#],Tr].d/100&
```
[Try it online!](https://tio.run/##bYy9CsIwFIV3n0IIdLqkSWrQDAVRV0XELWSIbVoDTSq1DiI@e7xDhw4O54ePwwl2vLtgR1/Z1JTp6KMPttu99ekVbm44uKoPj/7pNIG65Ix9UCAZCAYcC3CgQgLFThkm41@T5duLja3Te@c7H1tNBDFACrTrYGid40WWzoOPo260KOhKwpKjBDNm8Yfz9YxLRZWa9nLGN8iK6SP9AA "Wolfram Language (Mathematica) – Try It Online")
[Answer]
# [Kotlin](https://kotlinlang.org), 215 bytes
```
{p:Double,l:Int,h:Int->val d=listOf(10000,5000,2000,1000,500,100,25,10,5,1)
var m=Int.MAX_VALUE
var r=0.0
(Math.ceil(p*l).toInt()..(p*h).toInt()).map{var a=it
var c=0
d.map{c+=a/it
a%=it}
if(c<m){m=c
r=it/100.0}}
r}
```
[Try it online!](https://tio.run/##nVfrbts4Fv6vp2AzSSOlqnxJPd0Y9QDZTnY2QNMOkHQvKIKAlmibiCRqRCqJN8g8zDzKvlj3OyQly0k6O5gAkW3y8Ny@75xDXSuTy/Lr4IC9rwU3ImMLVTOzkpqlKhNsqfIFS1c8z0W5FNNgZUylp4MBbdJeog1Pr8UdRLCfpKoY/NIIbaQq9WD0/dH47TB4z/O0yaGccWZkxRotyyVsCKYLUqwNK5tiLmqmYEvJUgfBmcIqCaf@MLziVaWZlkWVr5nh16RugR1WiToVpeFLQQpIbyF4zqpapiJh5yq2MYk7jpMiZnLB1qqpnRDi3B0fJm8mMS3CWslywW9I92iyZz2Ysd3DZDKOGbnAClUjK6IUtWo0Gw87mTfJ90dJELxX5Y0oJfxholTNcmWNp7XIpIH6OkP4otYJ@2uDsJVhWnmP4LBYIAlGeRdSrlekXcPnkt2uZLqiNUEh4qmybI70MYqd8UI1pdHwzJAwJeGWryl6KDP7Gn5ncrG2GzITnKzMhYsm3bhsfSWzzsng35QorrVclgX2g@CftTTC@sM1W4hbNl8boelHpSA2pwRzRKKWNS8oY4umTIkNsAyoCDYrLcuqMdMgYPj7mYDqQ2dXz2Qpi6aw6d0g7Lb43XNbwXGZMdUYaLaqaNvlhd1KUNqlpSaisi@WHeyAFbK86hFowEbDYcy6XX73ZPfShVKQf/I/CIe0bgg8l3muB3NeXgNdChZOWVKzWvzSSBABLDnWuikskOzzOVAoheH1mmWgDPRyWz6kbPTf32I2ocdoSM@x/b47wv@EPuHq7pgeEzzIEpaGSXDiuB4EfxfAFxznoFr5mgoWFe4roUMJifl5bVaqBB6o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nU9yEfS8a0WDhzCyNXZB@Ge1RIm5a2v7kuLKq@CyDNGi9JQd1zVfvzs3aFPLH6KugD7YYuxdUJUj2Da5AGyvdDy6fvK0NYP7v5MZo2HYC/HX@2rqKzqfUimv6Pn6B1ths62asiVlK2rkf9KXGHWEMsIjCmwJzbZLxxbOjPLVZ/5B3iM8fq62@X1vaTgD8JZ7s2GQ2eX01YwTQ/ge9h4CuQjTd0V0X8zSoJ61wDw8BPXDVxvmBa6qeFvM2tc4N2VePrqP69glxTc6kixc18mkrnLuXkYcqpRJA633vjLydq7NrKEPGGhh9OJFgnPShDtsJ@oI5wQTjVHDXszYYTuozapGvZwCyiXPj@tlQy8wJ3epqAjtsDeEd05LWJRZ7xLPvbx@4S3dtC@U9oZDFr8ML5FcB3K4EQLNL@wLoZcaXbYQbET43ZbIeFvEjdOdPUxT@97C9rK9PWKn@8TJtRR5BmLvJF0UfuhuRuwFNUxnKerpzUuneacd09UmE984HPl6@VTizcGnL6a7BjCk90AA2oMYPWnBgai9SD/g1cCgl4WirlU9ZReECUfCoh7SKBfTmzT@w7@UjyY0bqK4c/Lp9uhtFLfLdmz7U5Onp2hcY/fQ6txcIsNv5M2@SZN3LaeIb44FaIsOevbyZYs51oAiFnrc8li7rU0z/JMo/0Gk/xDav4u4237UhlGgge/Hsvz6Pw "Kotlin – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~33~~ 32 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
“ñṇzi;’b⁴×H¥\ɓ_>Ƈ-Ṫ
PĊ1¦r/ÇƬL$ÞḢ
```
A monadic link accepting a list `[cost in cents, [minimum ratio, maximum ratio]]` which yields a tip amount in cents.
**[Try it online!](https://tio.run/##AVQAq/9qZWxsef//4oCcw7HhuYd6aTvigJli4oG0w5c6MsmXXMmTXz7Ghy3huaoKUMSKMcKmci/Dh8asTCTDnuG4ov///1s4MDAsIFswLjEzLCAwLjIwXV0 "Jelly – Try It Online")**
### How?
The first line is a helper Link which yields the amount given less the largest denomination note/coin:
```
“ñṇzi;’b⁴×H¥\ɓ_>Ƈ-Ṫ - Link 1, get next lower amount: integer, V
“ñṇzi;’             - base 250 number = 112835839060
       b⁴           - to base 16 = [1,10,4,5,8,10,4,4,5,4]
            \       - cumulative reduce with:       e.g.: 1,10   5,4   10,5   25,8
           ¥        -   last two links as a dyad:
         ×          -     multiply                        10     20    50     200
          H         -     halve                            5     10    25     100
                    - ...yielding: [1,5,10,25,100,500,1000,2000,5000,10000]
             ɓ      - start a new dyadic link with swapped arguments
              _     - subtract (vectorises) ...i.e. [V-1,V-5,V-10,...]
                Ƈ   - filter keep those which satisfy:
                 -  -   literal -1
               >    -   greater than? (i.e. if V-X > -1)
                  Ṫ - tail (tailing an empty list yields 0)
```
The number of calls required in order to reach zero is used to sort the range of tip amounts, and then the leftmost is yielded:
```
PĊ1¦r/ÇƬL$ÞḢ - Main Link: [cost, [min, max]]
P            - product = [cost*min, cost*max]
   ¦         - sparse application...
  1          - ...to indices: 1
 Ċ           - ...what: ceiling   -> [ceil(cost*min), cost*max]
     /       - reduce by:
    r        -   inclusive range (implicit floor of arguments)
          Þ  - sort by:
         $   -   last two links as a monad:
       Ƭ     -     repeat collecting results until a fixed point is reached:
      Ç      -       last link (1) as a monad  (e.g. 32 -> [32,7,2,1,0])
        L    -     length (i.e. coins/notes required + 1)
           Ḣ - head
```
]


[Question]
      [
## Introduction
Today's challenge is all about teeth. Specifically, how long it takes to brush from one tooth to another. Your challenge is, given the locations of two teeth, output the shortest amount of time possible to brush from the first to the second.
## Challenge
For this challenge we will be using a layout of an average adult human mouth:
[![Layout of human mouth.](https://i.stack.imgur.com/Hnpbj.gif)](https://i.stack.imgur.com/Hnpbj.gif)
This diagram shows the widely used [ISO numbering system](https://en.wikipedia.org/wiki/Dental_notation#ISO_System_by_the_World_Health_Organization). The system divides the mouth in four parts and assigns them each a number: upper right (1), upper left (2), lower left (3), and lower right (4). They then number the teeth of each section from the middle of the mouth out from 1-8. Therefore the fourth tooth from the center in the upper right side (section 1) is tooth number 14.
Let's assume brushing one tooth takes 1 unit of time. Moving from one tooth to the next one sideways takes 0 units of time. You can also cross from a tooth to the tooth directly above or below it, which also takes 1 unit of time. So how long does it take you to brush from tooth 14 to tooth 31? By looking at the diagram above, you will see it takes 7 units of time. Here is how that's calculated:
```
Action : Unit of time
Brushing tooth 14 : 1 unit
Brushing tooth 13 : 1 unit
Brushing tooth 12 : 1 unit
Brushing tooth 11 : 1 unit
Brushing tooth 21 : 1 unit
Cross to bottom of mouth : 1 unit
Brushing tooth 31 : 1 unit
------------------------------
Total: 7 units
```
Note his is not the only route we could have took, but there are no shorter routes.
So your challenge is:
* You will write a full program or function which accepts two arguments that are teeth numbers, and outputs (or returns) the shortest time to brush from one to the other.
* You make take input as numbers or strings, and output how ever you wish ([within acceptable methods](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods)).
* [Standard loopholes](https://codegolf.meta.stackexchange.com/questions/1061/loopholes-that-are-forbidden-by-default) are forbidden by default.
* This question is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so shortest bytecount wins.
* Here are some testcases (*Thanks Jonathan Allan*):
```
14, 21 => 5
14, 44 => 3
14, 14 => 1
33, 37 => 5
```
Good luck!

[Answer]
## JavaScript (ES6), 65 bytes
```
f=([s,t],[u,v])=>s<3^u<3?f(s+t,5-u+v)+2:s-u?t-+-v:t<v?++v-t:++t-v
for(i=1;i<5;i++)for(j=1;j<9;j++){let o=document.createElement("option");o.text=""+i+j;s.add(o);t.add(o.cloneNode(true));}
```
```
<div onchange=o.textContent=f(s.value,t.value)><select id=s></select><select id=t></select><pre id=o>1
```
Takes input as strings.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~24~~ 20 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
d30%20ị2¦⁵R;C$¤)ạ/Ḅ‘
```
A monadic link accepting a list of two integers (e.g. `[14,31]` for the from 14 to 31 example) which yields the brushing-time.
**[Try it online!](https://tio.run/##AS8A0P9qZWxsef//ZDMwJTIw4buLMsKm4oG1UjtDJMKkKeG6oS/huITigJj///8xNCwzMQ "Jelly – Try It Online")**
---
[Previous 24 byter](https://tio.run/##y0rNyan8/98iyNpZxVn7UeOWUB3tk9OBNNfDHa0WhxYdnZz5aOO6h7sW6j/c0fKoYcb///@jDXVMYnWijXUMYwE "Jelly – Try It Online") built the mouth and used base 8, input was a list of lists of digits:
```
8R;C$C+⁴U,+ɗ⁴
ḅ8¢œiⱮạ/Ḅ‘
```
[Answer]
# [Python 2](https://docs.python.org/2/), 91 bytes
```
def f(a,b):A,B=a/10,b/10;return[abs(a-b)%10+1+2*(A!=B),a%10+b%10+2-(A+B)%2*2][A!=B!=A+B!=5]
```
[Try it online!](https://tio.run/##Nc7BDoIwDAbgszxFdyBsUKIbIAlmGngNssMWIXIBMvHg0@MGcmjTb3/TbP4ur2kU6/rseuipRsOqGhupz/yCxrWb7ZaPHVtt3lSnhoX8kvBExLQmsmGovY1vIqV10rBQxEK1PiTSmchCrf1kwV1GC8MILbQ8R8g4Qqlwh3AoDuQ@PbCVR5a51/JYc0N2dUmhQFXBabbDuMD2e4zkPcL@Pz9IFNMdRFoWrD8 "Python 2 – Try It Online")
[Answer]
# JavaScript (ES6), 67 bytes
```
([a,b],[x,y])=>(u=(a==x)+3*!(a+x-5))?Math.abs(b-y)+u:2*!(a-x&1)+b+y
```
Expects inputs as two 2-element arrays of digits. `12` -> `[1, 2]` I hope this
is acceptable.
[Try it online!](https://tio.run/##XczRCoIwFAbg@55i3eROOxvMKUIwe4KeQHYxTawQDZ0xn96SUKyrw3f@n/9hX7YvuvvT8aa9llOlJ5pZzA1mHkcDOqWDplZrD0wd99Qyz2OA88W6m7B5T3M@AhtO4Zxxf5DAcjZOjmhChRC2q3ogOiVF2/RtXYq6rej8RBLwNEBSrS3YOZpJjAySLERpto4@Z2u5WKGarTBZnHytfvrqb2/tr/uxgekN "JavaScript (Node.js) – Try It Online")
Looks like a near duplicate to [@Chas Brown's Python
answer](https://codegolf.stackexchange.com/a/169106/81410), so I can remove it
if necessary (unsure of the conventions here).
# Explanation
```
var g =
([a,b], [x,y]) =>
    (u = (a == x)                // if same quadrant of mouth
     + 3 * !(a + x - 5))         // or strictly traversing vertically (e.g. 1 to 4, or 2 to 3)
        ? Math.abs(b - y) + u    // absolute difference plus additional units of time
        : 2 * !(a - x & 1)       // = 2 if traversing diagonally
            + b + y
```
[Answer]
# [Python 2](https://docs.python.org/2/), ~~80~~ 78 bytes
Probably some golfing opportunities here still
```
lambda s,e,l=(range(11)+range(0,-9,-1))*2:abs(l[s%30]-l[e%30]+s/30*2-e/30*2)+1
```
An unnamed function accepting two integers, `s` and `e`, which returns the brushing-time.
**[Try it online!](https://tio.run/##LcxBDoIwEIXhvaeYjaEDU6WUxEiCF0EXJRYlKYVQNoZw9tqKs5jvrf7ps7xHW/iuvnujhvapwJEmU7NZ2ZdmQmC2r5z4lbhATItKtY6Zxh1l/uCm0dHMnWWeFlz/wEz4bpxDCzT0FhgTJUmBFC3@luWuiEpJ8oJYHSDcNPd2gWTdCNYN@C385BR6g1pYTBJ0QY3ovw "Python 2 – Try It Online")**
[Answer]
# [Clean](https://github.com/Ourous/curated-clean-linux), ~~134~~ ~~128~~ 126 bytes
```
import StdEnv
@n=hd[i\\i<-[0..]&k<-[18,17..11]++[21..28]++[48,47..41]++[31..38]|n==k]rem 16
$a b=abs(@a- @b)+a/30bitxor b/30+2
```
[Try it online!](https://tio.run/##JY6xDoIwFEV3vuINxGiASqFRBpsw6GDCxggMr4DaQIsBNJr47daq27lnObfuW9RGDc2tb0Gh1Eaq6zDOkM/NQd@dVPNLU8iylLugCAmpFp0Fmvh0SwillecVESUkSr7EEp9ZzX46tjpOqpfmvKvGVgHdOC6C4CimZYoBpGLl4ToOhZwfwwjCoheZfEZb5@ACZRBT865PPZ4nExwzs39qVLL@D3swk@ID "Clean – Try It Online")
Defines the function `$ :: Int Int -> Int`, which just finds the distance between the two teeth as Cartesian coordinates. Pretty boring solution really.
]


[Question]
      [
In Russia we have something like a tradition: we like to look for lucky tickets.
Here's what a regular ticket looks like:
[![bus ticket](https://i.stack.imgur.com/0bqM1m.jpg)](https://i.stack.imgur.com/0bqM1m.jpg)
As you can see, the ticket has a six-digit number.
A six-digit number is considered **lucky** if the sum of the first three digits is equal to the sum of the last three.
The number on the photo is not lucky:
```
038937
038 937
0 + 3 + 8 = 11
9 + 3 + 7 = 19
11 != 19
```
## Challenge
Given the limits of a range (inclusive), return the number of lucky ticket numbers contained within it.
## Parameters
* Input: 2 integers: the first and last integers in the range
* The inputs will be between 0 and 999999 inclusive
* Output: 1 integer: how many lucky numbers are in the range
* You may take the inputs and return the output in [any acceptable format](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods)
* Assume leading zeros for numbers less than 100000.
## Examples
```
0, 1 => 1
100000, 200000 => 5280
123456, 654321 => 31607
0, 999999 => 55252
```
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so the shortest answer in bytes in every language wins.
Update: here's the lucky one [![lucky one](https://i.stack.imgur.com/a5RK9.jpg)](https://i.stack.imgur.com/a5RK9.jpg)

[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~8 (or 10?)~~ 11 (or 13?) [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
Ÿʒ₄n+¦S3ôOË
```
[Try it online](https://tio.run/##MzBNTDJM/f//6I5Tkx41teRpH1oWbHx4i//h7v//DYwtLE0NuECUgQEA) or [verify some more test cases](https://tio.run/##MzBNTDJM/W/q5un5/@iOU5MeNbXkaR9aFmx8eIv/4e7/tTr/DYwtLE0NuECUAZAyMDSAUIZgygjCMwLxjIzAPCAFkTMwgGkwBAA).
NOTE: In 05AB1E strings and integers are interchangeable, so the output numbers doesn't contain leading zeroes. This could however be fixed with 1 additional byte (**12 bytes**):
```
Ÿ₄n+€¦ʒS3ôOË
```
[Try it online](https://tio.run/##MzBNTDJM/f//6I5HTS152o@a1hxadmpSsPHhLf6Hu///NzC2sDQ14AJRBgYA) or [verify some more test cases](https://tio.run/##MzBNTDJM/W/q5un5/@iOR00tedqPmtYcWnZqUrDx4S3@h7v/1@r8NzC2sDQ14AJRBkDKwNAAQhmCKSMIzwjEMzIC84AURM7AAKbBEAA).
+3 bytes to bug-fix numbers with a length of 3 or less (range `[000000, 000999]`).
**Explanation:**
```
Ÿ          # Create an inclusive (on both sides) range from the two inputs
           #  i.e. 038920 and 038910 →
           #   [38910,38911,38912,38913,38914,38915,38916,38917,38918,38919,38920]
 ʒ         # Filter this list by:
  ₄n+      #  Add 1,000,000 to the number
     |     #  And remove the leading 1
           #   i.e. 38910 → 1038910 → '038910'
  S        #  Transform it to a list of digits
           #   i.e. '038910' → ['0','3','8','9','1','0']
   3ô      #  Split it into chunks of length 3
           #   i.e. ['0','3','8','9','1','0'] → [['0','3','8'],['9','1','0']]
     O     #  Sum the digits in both parts
           #   i.e. [['0','3','8'],['9','1','0']] → [11,10]
      Ë    #  Check if they are equal (if they are, they remain in the filtered list)
           #   i.e. [11,10] → 0
```
---
EDIT: Seems I (and most other answers) slightly misread the challenge and the amount of numbers is being asked instead of the numbers themselves within the range. In that case a trailing `}g` can be added (close the filter; and get the amount of numbers left in the filtered list), so it's **~~10~~ 13 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)** instead:
```
Ÿʒ₄n+¦S3ôOË}g
```
[Try it online](https://tio.run/##MzBNTDJM/f//6I5Tkx41teRpH1oWbHx4i//h7tr0//8NjC0sTQ24QJSBAQA) or [verify some more test cases](https://tio.run/##MzBNTDJM/W/q5un5/@iOU5MeNbXkaR9aFmx8eIv/4e7a9P86/w2MLSxNDbhAlAGQMjA0gFCGYMoIwjMC8YyMwDwgBZEzMIBpMAQA).
[Answer]
# [C# (.NET Core)](https://www.microsoft.com/net/core/platform), 93 + 18 = 111 bytes
```
a=>b=>Enumerable.Range(a,b-a+1).Select(e=>$"{e:D6}").Count(e=>e[0]+e[1]+e[2]==e[3]+e[4]+e[5])
```
[Try it online!](https://tio.run/##rZA/a8MwEMV3fQoROkgkMbb7B9pUXtJ2aqE0Qwbj4aycjcCRWkkOhODP7squM3Voh7zhnTjufryTdEtpLPatU7qmm6PzuI9elf5aESIbcI6@kxOhQZ9WHcAjdR68ktQi7Ixujuedl1bLR6X94ncjWJbRiooeRFaK7Fm3e7RQNhh9gK6RwaJcwjzh0QYblJ6hyK5mJ3x4uutmPFqbVo89zONijnkyWFoIgfn18LwZ7LbgPZ0Uog9lCnowakffQGnmvA1H5gUFWzs@zvycNmhKvTbamRBsa5XH8A/IKpbEccxZEgrnq78X/jNTsXSEpheGphM2vTA4MO9HnZkd6Uj/DQ "C# (.NET Core) – Try It Online")
18 bytes for `using System.Linq;`. I supposed that the input and output formats could be flexible. So I take two integers as input (the range, inclusive).
Some test results:
```
a=1000
b=1100
Lucky numbers = 3 [001001, 001010, 001100]
a=2000
b=2100
Lucky numbers = 3 [002002, 002011, 002020]
a=222000
b=222100
Lucky numbers = 7 [222006, 222015, 222024, 222033, 222042, 222051, 222060]
a=0
b=999999
Lucky numbers = 55252 (that's 5.5% of the total numbers)
```
[Answer]
# JavaScript (ES6), 66 bytes
Takes input in currying syntax `(m)(n)`, where **m** is the ~~exclusive~~ inclusive upper bound and **n** is the inclusive lower bound.
```
m=>g=n=>n<=m&&![...n+=''].reduce((t,d,i)=>t-=n[i+3]?d:-d,0)+g(-~n)
```
[Try it online!](https://tio.run/##Zcg7DsIwDADQnVuwtLbyUVQ2hMNBqg5VnEZBrYPawMjVg8TKG99jfs9H2POzGikc20JtI59IyMuNtq47j9ZaUdT3k90jv0IEqJp1RvLVkIxZXaY7Xw1rhyqB@Qi2UOQoa7RrSbDA4JxDcIinvx9@374 "JavaScript (Node.js) – Try It Online")
### How?
We test each number \$n\$ by walking through its digits \$d\_i\$ and updating a total \$t\$:
* \$t \gets t - d\_i\$ if there are at least 3 remaining digits after this one
* \$t \gets t + d\_i\$ otherwise
If we have \$t=0\$ at the end of the process, then \$n\$ is a lucky number.
---
# JavaScript (ES6), 67 bytes
Same input format.
```
m=>g=n=>n<=m&&!eval([...n/1e3+''].join`+`.split`+.`.join`^`)+g(n+1)
```
[Try it online!](https://tio.run/##ZcjBDoIwDADQu3/hBdo01oFXx48YTRccy8joCCP8/kz06Du@2R2ujFtc94vmt6@TrYsdglU76N0uTXP2h0vwYGa9dv5GbfvkOUcVEi5rirsQy29eghRAqcM6Zi05eU45wAS9MQbBIJ7@vv9@/QA "JavaScript (Node.js) – Try It Online")
### How?
For each number \$n\$:
* divide it by \$1000\$: e.g. `38937 --> 38.937`
* coerce to a string and split: `['3','8','.','9','3','7']`
* join with `+`: `"3+8+.+9+3+7"`
* replace `+.` with `^`: `"3+8^+9+3+7"`
* evaluate as JS code and test whether the result is \$0\$: `24` (\$11\$ XOR \$19\$)
If \$n \equiv 0 \pmod{1000}\$, no decimal point is generated and the evaluated expression is just a positive sum (falsy), unless \$n=0\$ (truthy). This is the expected result in both cases.
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~56~~ 54 bytes
```
->a,b{(a..b).count{|i|j=i.digits;j[0,3].sum*2==j.sum}}
```
[Try it online!](https://tio.run/##NYtBDoIwEEX3nGKWYGpTphQ0pnqQpgvQYNqgGIGFoZy9to3@ZDJ/8ua9l@7je@n355Z0a95S2hX0Oi7PeXXGWWnozdzNPJ2sYoRrOi2PHUppY9k2/wKVAajAoNRp0lmyGAKYdgACD@zPkFeiJlCLimOUeFmz5geDc0yJjkCBOtO0HYbL6nJDwBYERhc@e2WI1SAljNnmvw "Ruby – Try It Online")
### Method:
1. For every number, creates an array of digits (which comes out reversed)
2. Compares the sum of the first 3 digits in the array (last 3 in the number) multiplied by 2 to the sum of the entire array
3. Counts the numbers for which the two sums are equal
[Answer]
# [Japt](https://github.com/ETHproductions/japt), ~~38~~ 15 bytes
```
õV Ëì ò3n)mx r¥
```
*-23 thanks to Shaggy!*
My first Japt submission; thanks to Shaggy for all the help!
[Try it online!](https://tio.run/##y0osKPn///DWMIXD3YfXKBzeZJynmVuhUHRo6f//uhVcRkZGBgYGIMrQwAAA "Japt – Try It Online")
[Answer]
# Python 3, 117 113 106 135 bytes
This is my first answer ever so I'm sure there's room for improvement.
```
def x(a,b):
    n=0
    for i in range(a,b+1):
        if sum(map(int,str(i//1000)))==sum(map(int,str(i%1000))):n+=1
    print(n)
```
* *-4 bytes thanks to W W*
* *-7 bytes thanks to Asone Tuhid*
* *+29 bytes to create a function*
Gets the first three digits through integer division, and the last three through modulo. The first and last integers in the range are inputted as arguments of the `x` function, as `a` and `b`, respectively. Output is `n`, printed.
Ungolfed:
```
def x(a, b):
    n = 0
    for i in range(a, b + 1):
        if sum(map(int, str(i // 1000))) == sum(map(int, str(i % 1000))):
            n += 1
    print(n)
```
[Answer]
# [R](https://www.r-project.org/), ~~93~~ 86 bytes
Shorter logic at the end compliments of @Giuseppe/
```
function(a,b){for(i in sprintf("%06d",a:b)){x=utf8ToInt(i);F=F+!sum(x[1:3]-x[4:6])}
F}
```
[Try it online!](https://tio.run/##K/qfpmCj@z@tNC@5JDM/TyNRJ0mzOi2/SCNTITNPobigKDOvJE1DSdXALEVJJ9EqSVOzusK2tCTNIiTfM69EI1PT2s3WTVuxuDRXoyLa0Mo4Vrci2sTKLFazlsut9n@ahoGOJRho/gcA "R – Try It Online")
Integer inputs. Pad them with `0`. Convert to the six ASCII code points. Abuse the `F` builtin.
[Answer]
# [Husk](https://github.com/barbuz/Husk), 12 bytes
```
#ȯ§¤=Σ↓↑3↔d…
```
[Try it online!](https://tio.run/##yygtzv7/X/nE@kPLDy2xPbf4UdvkR20TjR@1TUl51LDs////hgYg8N8ITAEA "Husk – Try It Online")
## Explanation
```
#(§¤=Σ↓↑3↔d)…  -- example input: 100000 101000
            …  -- inclusive range: [100000,100001..100999,101000]
#(         )   -- count elements where (example with 100010)
          d    -- | digits: [1,0,0,0,1,0]
         ↔     -- | reversed: [0,1,0,0,0,1]
  §     3      -- | fork elements (3 and [0,1,0,0,0,1])
       ↑       -- | | take: [0,1,0]
      ↓        -- | | drop: [0,0,1]
   ¤=          -- | > compare the results by equality of their
     Σ         -- | | sums 1 == 1
               -- | : 1
               -- : 3
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 15 bytes
```
ＩＬΦ…·ＮＮ⁼Σι⊗Σ÷ιφ
```
[Try it online!](https://tio.run/##VclBCsJADIXhvafoMoUKY7curUJBRPQE02loA@lUZ5Jefwzixrf44eOF2aewei7lnigKnHwWuGKcZIYLsWCCPgbWTBs@fJzQ@FK56TLYVTfVH83nt3rO8NQFyNitOjCOX/dROtpoRKCmOjjn6t@OpbTGXWst@40/ "Charcoal – Try It Online") Link is to verbose version of code. Edit: I originally thought that it was the list of lucky numbers that was required. This can be done in 14 bytes (by removing the `Ｌ`, which takes the length of the list), or in 20 bytes if you want some nice formatting:
```
ＥΦ…·ＮＮ⁼Σι⊗Σ÷ιφ﹪%06dι
```
[Try it online!](https://tio.run/##VcpBCsIwEAXQvacIBWEKEWIXbtzWQhcV0ROkTdCBaVLTTK8fR3fO4sP7f6aXTVO0VMotYcgw2AU6pOwT9GEiXnHzdxueXrhwvvI8ylRr9Ufx5c2WVnjwDChsI4/k3c99yC1u6DygVkdjTP09rYbomCJUe3NylVYo5bmURh52jWQ5bPQB "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
    ＮＮ                  Input the range endpoints
  …·                    Inclusive range
 Φ                      Filter
        ι               Current value
       Σ                Sum of digits
            ι           Current value
             φ          Predefined variable 1000
           ÷            Integer divide
          Σ             Sum of digits
         ⊗              Doubled
      ⁼                 Equals
Ｅ                       Map over results
                   ι    Current value
               %06d     Literal string
              ﹪         Format value
                        Implicitly print each result on its own line
```
[Answer]
## [Perl 5](https://www.perl.org/) + `-pl -MList::Util+(sum)`, 49 bytes
```
@F=/./g,$\+=sum@F[5,4,3]==sum@F[2,1,0]for$_..<>}{
```
[Try it online!](https://tio.run/##K0gtyjH9/9/BzVZfTz9dRyVG27a4NNfBLdpUx0THONYWyjPSMdQxiE3LL1KJ19Ozsaut/v/fgMvQEgj@5ReUZObnFf/XLcj5r@vrk1lcYmUVWpKZo60B1KoJAA "Perl 5 – Try It Online")
---
## [Perl 5](https://www.perl.org/) + `-nl -MList::Util+(sum) -M5.010`, 50 bytes
To output each ticket instead is +1 byte:
```
@F=/./g,sum@F[5,4,3]-sum(@F[2,1,0])||say for$_..<>
```
[Try it online!](https://tio.run/##K0gtyjH9/9/BzVZfTz9dp7g018Et2lTHRMc4VhfI0QDyjHQMdQxiNWtqihMrFdLyi1Ti9fRs7P7/N@AytASCf/kFJZn5ecX/dfNy/uv6@mQWl1hZhZZk5mhrAA3QBAqZ6hkYGgAA "Perl 5 – Try It Online")
[Answer]
# [Python 3](https://docs.python.org/3/), ~~89~~ 86 bytes
-2 thanks to Mr. Xcoder.
-3 inspiring from Asone Tuhid answer's.
```
lambda a,b:sum(sum(map(int,str(i)))==2*sum(map(int,str(i)[-3:]))for i in range(a,b+1))
```
Tests results :
```
Example 1 :
a = 0
b = 1
Lucky numbers : 1
Example 2 :
a = 100000
b = 200000
Lucky numbers : 5280
Example 3 :
a = 123456
b = 654321
Lucky numbers : 31607
Example 3 :
a = 0
b = 999999
Lucky numbers : 55252
```
[Try it online!](https://tio.run/##fczBDoIwDAbg@56i2WnVmUC5LeHozTcQD0NBF9lYBiTy9Mhi0BiihyZ/2r@fH/tb67Kpzoup0ba8aNCyVN1gRRyrvTCul10fhEHEPKfNen/cZeqEWLcBDBgHQbtrJWZnmyJOPsxNwTnfP7T1TQUpKGAackiTJGFlDHNih@F8H8ENtqxCB2p@kLWIFRnPKHnhODK24mjhaOHoJxcrkv5y2ZujD0h/SHqh9MVOTw "Python 3 – Try It Online")
[Answer]
# [MATL](https://github.com/lmendo/MATL), 24 bytes
```
&:1e3&\,!'%03d'&V2&sw]=s
```
[Try it online!](https://tio.run/##y00syfmf8F/NyjDVWC1GR1Fd1cA4RV0tzEituDzWtvi/S8h/S0tLAwMuSxDgMuAy5DIwMDQACgApIM0FYgMpIzAFAA "MATL – Try It Online")
*(-2 bytes thanks to Luis Mendo.)*
`&:` - Make an inclusive range between the two given numbers
`1e3&\` - 'divrem' - divide by 1000 and get the reminders and floored quotients in two arrays.
`,` - do twice
`!'03d'&V` - transpose and convert each value to a zero-padded three-width string
`&s` - sum each row's values
`w` - switch to bring the reminder array out and do this again on that
`]` - end loop
`=` - check for equality (returns 1s in places where the arrays are equal)
`s` - sum those to get the count (implicit output)
[Answer]
# [Kotlin](https://kotlinlang.org), 152 119 bytes
```
{a:Int,b:Int->(a..b).map{String.format("%06d",it)}.filter{it[0].toInt()+it[1].toInt()+it[2].toInt()==it[3].toInt()+it[4].toInt()+it[5].toInt()}.count()}
```
[Try it online!](https://tio.run/##ZY1dC4IwFIav9VcMIdjIxlwfkKTQZdddRhezmox0yjoGIf72tSwk8Vycs@d5z2H3CgqlrWw0KoXSWJj8EaO9MeK1O4JROk8Jan3vKQokUWJbER80hNmnL1IsKM0ILUXdfpeprEwpAAcztrkGoQLSUakKuJlWwYmdKVTuEJO5o2hEfKAkcbgchasRrQfq6KVq@of1avc/FBpLHDHGQhS5QYj/53nv@dTzX8KnmdPbvpzufPsG "Kotlin – Try It Online")
Taking two integers than convert it into six symbol strings and count.
Optimized it thanks to mazzy and his [solution](https://codegolf.stackexchange.com/a/169047/81779) to 119 bytes.
```
{a:Int,b:Int->(a..b).count{val d="%06d".format(it);(d[0]-'0')+(d[1]-'0')+(d[2]-'0')==(d[3]-'0')+(d[4]-'0')+(d[5]-'0')}}
```
[Try it online!](https://tio.run/##ZY5dC4IwFIav9VcMIdxIx1wfkDWhy667jC5mMhnpjDWDEH/7mhoYdC7OeXjec/HeG1NJZUWrQM2lglyXzxQctebvw9loqcoMgc73XrwCAjDb8fSkTJQPO84gxzhH@Na0ynTDS8GCBdkWARaNrrmB0qA9LC7kGockREuHyYx0QsYcr2a9nnEzYd9b7@G6mEpBARNCSAQSdxDyfzwdPf339JvQ/8zp3ThO9779AA "Kotlin – Try It Online")
[Answer]
# [dc](https://www.gnu.org/software/bc/manual/dc-1.05/html_mono/dc.html), 44 bytes
```
sb[d]sD[dA00~[rA~rA~++rx]dx=D1+dlb!<L]dsLxkz
```
Takes two arguments from an otherwise empty stack, outputs to top of stack.
[Try it online!](https://tio.run/##S0n@b2hkbGJqpmBmamJsZPi/OCk6JbbYJTrF0cCgLrrIsQ6ItLWLKmJTKmxdDLVTcpIUbXxiU4p9KrKr/hf8BwA "dc – Try It Online")
The clever bit here is the use of an unnamed (i.e., unstored) macro that's duplicated before execution in order to run a copy of itself on the other three-digit part.
# Explanation
The inner macro `[rA~rA~++rx]` has the effect "calculate the digit sum of the three digit number that is second-to-top on the stack, then execute the original top of the stack as a macro".
Main program:
```
sb             Saves the upper bound as b so we'll know when to quit
[d]sD          Defines the macro D, which contextually is "increment stack depth"
[              Start the main loop - the next number to test is on top
  d              Make a copy to increment later for loop purposes
  A00            The literal "1000"
  ~              Quotient and remainder, so "123456" is now "123 456"
  [rA~rA~++rx]d  Stack is now "123 456 M M", where M is the anonymous macro
  x              Run M on the stack "123 456 M", which (see definition
                 above) ends up running M on the stack "123 15", which
                 leaves "15 6" (and executes the 6, which is a no-op)
  =D             If the two sums were equal, increment the stack depth
  1+             Increment the current test number
  dlb!<L         Loop unless the test number is now larger than b
]dsLx          Name and start the loop
kz             Current depth is 1+answer, so throw away top and return
```
[Answer]
# [Pascal (FPC)](https://www.freepascal.org/), ~~163~~ 153 bytes
```
var a,b:Int32;begin read(a,b);for a:=a to b do if a div$186A0+a div$2710mod$A+a div$3E8mod$A=a div$64mod$A+a div$Amod$A+a mod$Athen b:=b+1;write(b-a)end.
```
[Try it online!](https://tio.run/##TYlBDoIwFESv8hcsIIhpwSC2YdGFC4/xS1ttgi2pDR6/kqKJs5l58xZ8TTg3ZplSWjEAHiS7udi1XOq7dRA0qnI7K278ZtmIED1IUB6sAQRl14IOvSD1vtszJU@vCvHl7jpkHHfsT/9S/CB3fGgHko2ypvwdbNSlbLDSTh1TInDJ@QA "Pascal (FPC) – Try It Online")
## Explanation
Here is some normal-looking code first:
```
var a,b,i,s,c,d:Int32;
begin
  read(a,b);
  s:=0;
  for i:=a to b do begin
    c:=i div 1000;
    d:=i mod 1000;
    if c div 100+(c div 10) mod 10+c mod 10=d div 100+(d div 10) mod 10+d mod 10 then begin s:=s+1; {writeln(i)} end;
  end;
  write('There are ',s,' numbers');
end.
```
[Try it online!](https://tio.run/##XY9NDoIwEIX3nOLtgFANf7qAcAD3XqB0ijSRYlrUhfHsWLRE42Jm3sx8ycy7cCv4edNdxDzfuAFnLVPMMsGoOuipyOuglSelA8BITpHbx7VrbNWkS@1GA1U1HNOIFuSSpwFRNQqkbsjS9M0CtIyGkX5GqoNYqSRaZeypRHjR0Beif4i8wNRL/flgedAmWY3H3ahJnnWk4iekpuWqL@9NFB57aSS4i9AZD6GvQyuNDZ1PB27nOcuLcrfHflcWefYC "Pascal (FPC) – Try It Online")
Then I abused the behaviour of the for loop:
* the loop values are set beforehand (from `a` to `b`), so `a` can be reused as the loop variable, dropping `i`;
* at the end of the for loop, loop variable is left at the final value (value of `b` before the loop). I used `b` as a container, incrementing it when a lucky number is found and at the end of the loop `b` is away from its old value by amount of lucky numbers, so `b-a` gives the correct result. This dropped `s`.
Replacing `d` with operations directly on `a` shortens the loop. Replacing `c` with operations directly on `a` dose not shorten the loop, but, after dropping `d`, loop's `begin` and `end` are unnecessary and I ended with using only 2 variables :)
`$` starts hexadecimal constants in the golfed code. While they do not save bytes, they eliminate spaces needed before decimal constants.
[Answer]
# [Java (OpenJDK 8)](http://openjdk.java.net/), 162 bytes
... borrows from the Kotlin example above.
```
import java.util.stream.IntStream;
(a,b)->IntStream.range(a,b+1).mapToObj(i->String.format("%06d",i).getBytes()).filter(c->c[0]+c[1]+c[2]==c[3]+c[4]+c[5]).count();
```
[Try it online!](https://tio.run/##lVHBasMwDL33K0RhYNPEJGkbGKU97DZYt0N3Czk4rps5dewQOx1h9NszO@1Gd1uFLcl6EnqSK3qioW64qvbHQdSNbi1ULkY6KyQxtuW0Js/K7kZvNZkwSY2BLRXqawIglOXtgTIOLx079q9dXfDWeARAalXCh/7cUtUjlwg08PlQ4JXDz@66Yyy1gv2pBnn7WMOAaFDgcPPLgrRUldxHZzEmNW3e9VtRIRFuHC5USQ66ralF04co3U8DgUnJ7VNvuUEYk4OQjjNi4YZlUT5jWexVkq/XLJt7d@HVMseE6U5ZhFeDGxug6QrpmF4Jn7TYQ@22gC49sxwovsy9643lNdGdJY2DrFTodiLysxKfC1EwmhiPS/l/cRx5CZLR3F2czBfLNEiXi3lyd@cr7cdR8PUvz8M3 "Java (OpenJDK 8) – Try It Online")
Comparing the sum of the String's bytes is just as good as summing up the actual digits.
[Answer]
# [PHP](http://www.php.net/), 131 bytes
```
<?$f='array_sum(str_split(str_split(sprintf("%06d",$i),3)[';for($i=$argv[1]-1;$i++<$argv[2];)eval("\$a+=$f 0]))==$f 1]));");echo$a;
```
To run it:
```
php -n <filename> <from> <to>
```
Example:
```
php -n lucky_tickets.php 100 100000
```
Or [Try it online!](https://tio.run/##TcfRCsIgGIbhWwn5Y4obaEEnTrqQNYbUbMKm8muDbj7b6KQPXni@OMVS2itYXRlE8x7Sa6Ep45Di7PK/IjqfLSVHcXmQGhyrz6yrlA1IwWkw@Fw72TdSgeO8/f1Tr9i4mpmSGxiuwR5Ez5jeITcowtR4nwIYVUqRQuxt@4SYXfCpNP4L "PHP – Try It Online")
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), ~~51~~ 49 bytes
```
{+grep {[==] .flip.comb[^3,3..*]>>.sum},$^a..$^b}
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYKvwv1o7vSi1QKE62tY2VkEvLSezQC85PzcpOs5Yx1hPTyvWzk6vuDS3VkclLlFPTyUuqfZ/cWKlQpqGgY6hpjUXhG1oAAQ6CkYgStP6PwA "Perl 6 – Try It Online")
Anonymous code block that takes a two numbers and returns the number of lucky ones. Times out for larger inputs
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~9~~ 8 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
-1 thanks to Dennis (`rµ...E)S` -> `r...E€S` since everything vectorises.)
```
rdȷD§E€S
```
A dyadic Link accepting the two endpoints of the range (either way around) which yields the count of lucky tickets.
**[Try it online!](https://tio.run/##y0rNyan8/78o5cR2l0PLXR81rQn@//@/oQEI/DcCUwA "Jelly – Try It Online")** Or see a [test-suite](https://tio.run/##y0rNyan8/78o5cR2l0PLXR81rQn@f3i5PpD@/z/aQMcwVifa0AAEdIzAFIhvZGxiaqZjZmpibASSN9CxBINYAA "Jelly – Try It Online")
### How?
Note that for any non-negative integer less than \$1000000\$, \$N\$, we can get two numbers with digits that sum to the required values to check using integer division by \$1000\$
(yielding, say, \$X=\lfloor\frac{N}{1000}\rfloor\$)
and its remainder
(say \$Y=N\mod{1000}\$)
...that is, \$N=1000\times X+Y\$
Now we want to compare the sums of the digits of \$X\$ and \$Y\$ for each \$N\$ in a range and count those that are equal.
```
rdȷD§E€S - Link: integer a; integer b
r        - inclusive range [a,b] (either [a,a+1,a+2,...,b] or [a,a-1,a-2,...,b])
         -                              e.g.: 0       or 78        or 7241
  ȷ      - literal 1000
 d       - divmod (vectorises)                [0,0]      [0,78]       [7,241]
   D     - to decimal lists (vectorises)      [[0],[0]]  [[0],[7,8]]  [[7],[2,4,1]]
    §    - sum each (vectorises)              [0,0]      [0,15]       [7,7]
     E€  - for €ach: all equal?               1          0            1
       S - sum (counts the 1s in the resulting list)
```
[Answer]
# Powershell, 85 bytes
```
($args[0]..$args[1]|%{'{0:D6}'-f$_}|?{+$_[0]+$_[1]+$_[2]-eq+$_[3]+$_[4]+$_[5]}).count
```
Test script:
```
$f = {
($args[0]..$args[1]|%{'{0:D6}'-f$_}|?{+$_[0]+$_[1]+$_[2]-eq+$_[3]+$_[4]+$_[5]}).count
}
@(
    ,((0,1), 1)
    ,((1000,2000), 3)
    ,((2000,3000), 6)
    ,((10000, 20000), 282)
    ,((101000, 102000), 6)
    ,((201000, 202000), 10)
    ,((901000, 902000), 63)
    ,((100000, 200000), 5280)
    ,((123456, 654321), 31607)
    #,((0, 999999), 55252)
) | % {
    $c, $e = $_
    "      $c"
    $r = &$f $c[0] $c[1]
    "$($e-eq$r): actual=$r expected=$e"
}
```
Output:
```
      0 1
True: actual=1 expected=1
      1000 2000
True: actual=3 expected=3
      2000 3000
True: actual=6 expected=6
      10000 20000
True: actual=282 expected=282
      101000 102000
True: actual=6 expected=6
      201000 202000
True: actual=10 expected=10
      901000 902000
True: actual=63 expected=63
      100000 200000
True: actual=5280 expected=5280
      123456 654321
True: actual=31607 expected=31607
```
[Answer]
# Kotlin, 95 bytes
```
{a:Int,b:Int->(a..b).count{val d="%06d".format(it);d.chars().sum()==2*d.take(3).chars().sum()}}
```
`.kt` for test:
```
var  f = {a:Int,b:Int->(a..b).count{val d="%06d".format(it);d.chars().sum()==2*d.take(3).chars().sum()}}
fun main(args: Array<String>) {
    println(f(0,1))             // 1
    println(f(1000,2000))       // 3
    println(f(2000,3000))       // 6
    println(f(101000, 102000))  // 6
    println(f(201000, 202000))  // 10
    println(f(901000, 902000))  // 63
    println(f(10000, 20000))    // 282
    println(f(100000, 200000))  // 5280
    println(f(123456, 654321))  // 31607
    println(f(0, 999999))       // 55252
}
```
# Explanation
Count numbers from range where sum of all number digits is equal to double sum of first 3 digits.
[Answer]
# [Stax](https://github.com/tomtheisen/stax), 14 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
ît║l`Yµß╖vYü╢^
```
[Run and debug it](https://staxlang.xyz/#p=8c74ba6c6059e6e1b7765981b65e&i=0,+1%0A100000,+200000%0A123456,+654321%0A0,+999999&a=1&m=2), but be patient!
[Answer]
# [Python 2](https://docs.python.org/2/), ~~83~~ 80 bytes
-3 by using Asone Tuhid's observation - [go give credit!](https://codegolf.stackexchange.com/a/168983/53748)
```
lambda a,b:sum(sum(map(int,`v/1000`))*2==sum(map(int,`v`))for v in range(a,b+1))
```
**[Try it online!](https://tio.run/##VU1dC8IwDHz3V@TNRIN23Qc46D/xYR1aHdhuzDmQsd8@0755kBy5C3fDd3r2QW/OXLeX9e3NguW2fn88xvF2wC5M3MznTCnVEB20Mf@OiK4fYYYuwGjD446ScMyItihbhjY6iIohIwaMQUoOnTgpOi/KiqEqi1ynH7EvCUT1DgTDKGWwd7isDMtKYGTvT9Lg7YSxhMEllt4f "Python 2 – Try It Online")**
Much like my Jelly answer (but the inputs must be sorted here i.e. `a<=b`)
---
**75 bytes** for input `a, b+1` (i.e. range excludes the right bound):
```
lambda*r:sum(sum(map(int,`v/1000`))*2==sum(map(int,`v`))for v in range(*r))
```
[Try this one](https://tio.run/##VY3dCsIwDIXvfYrcmYygXfdzMeibeLEOrQ5sN@ocyNizz2ZeGUgOOTnkGz/TYwh6c@ayPa3vrjaLzevtUdrbEfswcTufc6VUS5RpY/4vyXRDhBn6ANGG@w2zSLSJZxk6sREVgyYGlC9KFpF8d3RRVjVDXZWF3jPp/IspouYAqcaYUHB0uKwMy0pg0jyeEsLbCYXC4HZN4C8 "Python 2 – Try It Online")
[Answer]
## Clojure, 102 bytes
```
#(count(for[i(range %(inc %2)):when(=(let[d(map int(format"%06d"i))](apply +(map -(drop 3 d)d)))0)]i))
```
Mixing strings and math isn't too fun.
[Answer]
# [J](http://jsoftware.com/), 35 bytes
```
[:+/(6#10)([:=/_3+/\])@#:[+i.@>:@-~
```
[Try it online!](https://tio.run/##y/qvpKeeZmulrlNrZaBgZfA/2kpbX8NM2dBAUyPaylY/3lhbPyZW00HZKlo7U8/BzspBt@6/Jldqcka@gqEBCCikKRiBGVypFZkl6ur/AQ "J – Try It Online")
[Answer]
# C (gcc), ~~90~~ 88 bytes
```
l=10;u(c,k,y){for(y=0;c<=k;)c++%l+c/l%l+c/100%l-c/1000%l-c/10000%l-c/100000%l?:++y;c=y;}
```
Port of my Java [answer](https://codegolf.stackexchange.com/a/169632/79343). Try it online [here](https://tio.run/##fVB/S4RAEP37/BTTgbDiHq3raT@2LYIKoqAv0D@yriG3qXhayeFnt3HRziBalp03M@89Zkdt3pQaBiMDJlqi6I523iEra9JJJtSV3AlP@b5rfHVq7Bsw5pqNjUewQAhvLn2/E0p2oh8@yjyFRu8bkhcNmPJT1xRG2FbVDPVXpVWjUw8OzmosJKppEwMSWjIpLNsT2M7ITAcpJ6YVrqoatRlZEzel4KKbvMYA5OXJey3WFJZWdFaiZQ/a7PV/FifSGj3cPj7f3/1lNo/0y9bpHWf8zXuSF8SOaPfAKAR4R4rNxwTXRoEdS3aRFPgUI36@aPJwG8UU4mgbchSHQczOfrrIvrAHVRGPODZ6Z/gG). Thanks to [ceilingcat](https://codegolf.stackexchange.com/users/52904/ceilingcat) for golfing two bytes.
Ungolfed:
```
l=10; // constant, we will be using the number 10 rather a lot
u(c, k, // function returning an integer and taking two integer arguments: lower and upper bound
  y) { // abusing the argument list to declare a variable of type integer: the number of lucky tickets found in the range
    for(y = 0; c <= k; ) // set count to 0 and loop through the range
        c++ %l + c/l %l + c/100 %l // if the digit sum of the second half of the ticket number ...
        - c/1000 %l - c/10000 %l - c/100000 %l // ... is the same as the digit sum of the first half ...
        ?: ++y; // ... it's a lucky ticket: increment the count
    c = y; // return the count
}
```
[Answer]
# Java 8, ~~101~~ 99 bytes
```
u->l->{int n=0,d=10;for(;l<=u;)if(l++%d+l/d%d+l/100%d==l/1000%d+l/10000%d+l/100000%d)++n;return n;}
```
A different approach than [the other Java answer](https://codegolf.stackexchange.com/a/169005/79343). Instead of using streams and Strings, this uses a loop and evaluates the numbers directly. Try it online [here](https://tio.run/##tVJRS8MwEH6uv@IsDFra1a5bp9KlIOhgqPiwR/EhttnIlqWlTaZj9LfPJOtE3R4EsZTed1/uvrvrZYHXuFuUhC/y5a6Ur4xmkDFc1/CIKYftmdWStcBCmXVBc1ipI2cqKsrnzy@Aq3nt6khrocQCKSgLZpJnghY8GLdgNOGCzEnlw6@CWpCmwGS23ACCneymrJtuKRfAUejnqBcms6JyEjZCMnHpzGGe18k9dpGbby8MOzlCBoQH5itS0PU8nlREyIoDT5qdZSVqDEFq4Zi6PoQ@9NTr/uQ1qSRUwPGREfcham0cXZ0IivqDeOjDMB70IyXW7w3DS/dE9WvzKJU4iiMd0KiVVHSNBfm2E5P2bwvwQf93VrzpMw1lWR4geS9JJki@vwOawZmQmKmlmdwAlyXbOCbDbR2jZMZVezsIAEJt6l7Kmm5qQVZBIUWgRuaCccd2bPD2jShr@6BdI61dF1BqmLYDRYHzdO/aplQDhNXkr9Kf3Wrxc3RUbnwzebi7PZTU@2p2Hw).
Thanks to [ceilingcat](https://codegolf.stackexchange.com/users/52904/ceilingcat) for golfing two bytes.
Ungolfed:
```
u -> l -> { // lambda taking two integer arguments in currying syntax and returning an integer
    int n = 0, // the counter
        d = 10; // auxiliary constant, we will be using the number 10 rather a lot
    for(; l <=u ; ) // loop over all ticket numbers in the range
        if(l++ %d + l/d %d + l/100 %d // if the digit sum of the second half of the number ...
           == l/1000 %d + l/10000 %d + l/100000 %d) // ... is the same as the digit sum of the first half ...
            ++n; // ... it's a lucky ticket, add 1 to the counter
    return n; // return the count
}
```
[Answer]
# VBA (Excel), 159 bytes
Using Immediate Window and Cells `[A1]` `[A2]` as input.
```
c=[A1]-[A2]:d=IIf(c<0,[A1],[A2]):For x=d To d+Abs(c):e=String(6-Len(x),"0")&x:For y=1To 3:i=i+Mid(e,y,1):j=j+Mid(e,7-y,1):Next:z=IIf(i=j,z+1,z):i=0:j=0:Next:?z
```
[Answer]
## F#, 110 bytes
```
let t=string>>Seq.sumBy(int>>(-)48)
let r s e=Seq.where(fun n->t(n/1000)=t(n-(n/1000)*1000)){s..e}|>Seq.length
```
[Try it online!](https://tio.run/##XVDBTsMwDL3vK6xJSAlaS9Z1EwiaAxJXhOA47VBtbhexeSNxQRPj20tiQAOsKI7fe3620oRsufPY9xtk4Cqwd9Ra@4Qveei2twfliK1VmS4v9SBpPATAKvFva/Somo6AMsuKLsbGGF3FV/ZTnMut30Oe48dRXDdILa/7@c0dsT887JL/Qpy3tSOoffsK1QBizJUZwVhfSwEqWZmIFJJPcDEpp7MRzKblpDipo/BKQi8EOVpI0x2jB9l5XzsPmf2Sx0gbBK49QwVNYOH/kEir@8gFWv3juuXz4bGmFr/7RRjn7eNXckMwPHMgZ/hLoKXf9J8)
`t` converts the string into numbers and sums them up. `r` takes the range of numbers from `s` to `e`, and filters out the numbers that are unlucky. The first three digits are collected by `n/1000`. The second three digits are computed by `n-(n/1000)*1000`.
]


[Question]
      [
Create a function, expression, or program which does the following:
1. Take the prime factors of any number and sum them. For example, the prime factors of 28 are 2 2 7, summed to 11.
2. Multiply the result by the number of prime factors for the given number. E.g, 28 has 3 prime factors which sum to 11. 11 \* 3 is 33.
3. Repeat the process recursively, storing the resulting list (which starts with the original number), until you reach a number that is already included in the list. Halt without adding that final number, so that the list contains no duplicates. The progression for 28 is 28 33, because 33 results in 28 again.
4. Count the elements in the resulting list. In the case of 28, the answer is 2.
Here are the results for `0<n<=10`, so you can check your algorithm.
`2 1 1 10 1 11 1 9 5 10`
(As balpha pointed out, the answer for `higley(1)` is 2, from the list 1 0. I originally had 1, due to a bug in my original algorithm written in J.)
Since I'm a conceited SOB and haven't found this on [OEIS](http://oeis.org), let's call this the "Higley Sequence," at least for the duration of this round of code golf. As an added bonus, find the first two `n` having the lowest `higley(n)` where `n` is not prime and `n>1`. (I think there are only two, but I can't prove it.)
This is standard code golf, so as usual the fewest keystrokes win, but I ask that you please upvote clever answers in other languages, even if they are verbose.

[Answer]
# J, 47 45
```
#@((~.@,[:(+/@{:*+/@:*/)2 p:{:)^:_)`2:@.(=&1)
```
It's possible this would be much shorter without using `^:_`, but my brain is sufficiently fried already.
**Edit:** (47->45) Double coupon day.
Usage:
```
   higley =: #@((~.@,(+/@{:*+/@:*/)@(2&p:)@{:)^:_)`2:@.(=&1)
   higley 1
2
   higley"0 (1 + i. 10)
2 1 1 10 1 11 1 9 5 10
```
[Answer]
### Golfscript, 68 67 62 61 chars
```
[.]({[.2@{1$1$%{)}{\1$/1$}if}*;;].,*0+{+}*.2$?@@.@+\@)!}do;,(
```
This is an expression: it takes `n` on the stack and leaves the result on the stack. To turn it into a program which takes `n` from stdin and prints the result to stdout, replace the leading `[` with `~`
The heart of it is `[.2@{1$1$%{)}{\1$/1$}if}*;;]` (28 chars) which takes the top number on the stack and (by an incredibly inefficient algorithm) generates a list of its prime factors. C-style pseudocode equivalent:
```
ps = [], p = 2;
for (int i = 0; i < n; i++) {
    if (n % p == 0) {
        ps += p;
        n /= p;
    }
    else p++;
}
```
The `0+` just before `{+}*` is to handle the special case `n==1`, because Golfscript doesn't like folding a binary operation over the empty list.
One of the non-prime fixpoints is 27; I found this without using the program by considering the mapping (pa `->` a2p), which is a fixpoint if a == p(a-1)/2, and trying small `a`. (`a==1` gives the fixpointedness of primes).
Searching with the program turns up a second fixpoint: 30 = (2+3+5)\*3
---
### Appendix: proof that there are only two non-prime fixpoints
Notation: `sopfr(x)` is the sum of prime factors of `x`, with repetition (A001414). `Omega(x)` is the number of prime factors of `x` (A001222). So the Higley successor function is `h(x) = sopfr(x) Omega(x)`
Suppose we have a fixpoint `N = h(N)` which is a product of `n=Omega(N)` primes.
`N = p_0 ... p_{n-1} = h(N) = n (p_0 + ... + p_{n-1})`
Basic number theory: `n` divides into `p_0 ... p_{n-1}`, so `w=Omega(n)` of those primes are the prime factors of `n`. Wlog we'll take them to be the last `w`. So we can divide both sides by `n` and get
`p_0 ... p_{n-w-1} = p_0 + ... + p_{n-1}`
or
`p_0 ... p_{n-w-1} = p_0 + ... + p_{n-w-1} + sopfr(n)`
Given that all of the primes `p_0` to `p_{n-w-1}` are greater than 1, increasing any of them increases the LHS more than the RHS. So for a given `n`, we can enumerate all candidate solutions.
In particular, there can be no solutions if the LHS is greater than the RHS setting all the "free" primes to 2. I.e. there are no solutions if
`2^{n-w} > 2 (n-w) + sopfr(n)`
Since `sopfr(n) <= n` (with equality only for n=4 or n prime), we can make the weaker statement that there are no fixpoints if
`2^{n-w} > 3 n - 2 w`
Holding `w` fixed we can select different values of `n` satisfying `w=Omega(n)`. The smallest such `n` is `2^w`. Note that if `2^{n-w}` is at least 3 (i.e. if `n-w>1`, which is true if `n>2`) then increasing `n` while holding `w` constant will increase the LHS more than the RHS. Note also that for `w>2` and taking the smallest possible `n` the inequality is satisfied, and there are no fixpoints.
That leaves us with three cases: `w = 0` and `n = 1`; `w = 1` and `n` is prime; or `w = 2` and `n` is semi-prime.
Case `w = 0`. `n = 1`, so `N` is any prime.
Case `w = 1`. If `n = 2` then `N = 2p` and we require `p = p + 2`, which has no solutions. If `n = 3` then we have `pq = p + q + 3` and two solutions, `(p=2, q=5)` and `(p=3, q=3)`. If `n = 5` then `2^4 > 3 * 5 - 2 * 1`, so there are no further solutions with `w = 1`.
Case `w = 2`. If `n = 4` then `N = 4pq` and we require `pq = p + q + 4`. This has integer solution `p=2, q=6`, but no prime solutions. If `n = 6` then `2^4 > 3 * 6 - 2 * 2`, so there are no further solutions with `w = 2`.
All cases are exhausted, so the only non-prime fixpoints are 27 and 30.
[Answer]
## Ruby, 92 characters
```
f=->i{r=[i];(x=s=0;(2..i).map{|j|(s+=j;x+=1;i/=j)while i%j<1};r<<i=s*x)until r.uniq!;r.size}
```
This solution assumes higley(1) is actually 2, not 1 (see balpha's comment above):
```
(1..10).map &f
=> [2, 1, 1, 10, 1, 11, 1, 9, 5, 10]
```
[Answer]
## Octave - 109 chars
```
l=[input('')];while size_equal(unique(l),l);n=factor(l(1));l=[sum(n)*length(n) l];endwhile;disp(length(l)-1);
```
[Answer]
# [Husk](https://github.com/barbuz/Husk), 9 bytes
```
LU¡o§*LΣp
```
[Try it online!](https://tio.run/##yygtzv7/3yf00ML8Q8u1fM4tLvj//7@hAQA "Husk – Try It Online") or [Verify first 10 tests](https://tio.run/##yygtzv6f@6ip8eGOxYYG/31CDy3MP7Rcy@fc4oL//wE "Husk – Try It Online")
## Explanation
```
LU¡o§*LΣp input → n
  ¡o      create an infinite list:
        p get the prime factors
      L   length
    §*    times
       Σ  sum
 U        longest unique prefix of the infinite list
L         length of the prefix
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 9 bytes
```
ÆfS×LƊ$ƬL
```
[Try it online!](https://tio.run/##y0rNyan8//9wW1rw4ek@x7pUjq3x@X@4/VHTmv//jQ0A "Jelly – Try It Online")
## Explanation
```
ÆfS×LƊ$ƬL   Main monadic link
       Ƭ    Repeat and collect results until a duplicate occurs
      $     (
Æf            Prime factorization
     Ɗ        (
  S             Sum
   ×            Multiplied by
    L           Length
     Ɗ        )
      $     )
        L   Length
```
[Answer]
# [MATL](https://github.com/lmendo/MATL), 19 bytes
```
i`vt0)Yftnws*yy-]xn
```
[Try it online!](https://tio.run/##y00syfmf8D8zoazEQDMyrSSvvFirslI3tiLvv0vIfyMLLkMuIy5jLhMuUy4zLnMuCy5LLkMDAA "MATL – Try It Online")
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 10 bytes
```
l.u*sJPNlJ
```
[Try it online!](https://tio.run/##K6gsyfj/P0evVKvYK8Avx@v/fxMA "Pyth – Try It Online")
---
Explanation:
```
 .u       Q | N = input, then N =
    s       |  sum of
      PN    |   list of prime factors of N
     J      |   (call this list J)
   *        |  times
        lJ  |  length of J
 .u         | until a previous result is repeated. return the list of results
l           | print the length of the list
```
]


[Question]
      [
### Kids-related intro
Whenever I take my kids to an amusement park, the kids get more nervous the closer we are to the park, with the nerve peak when we are in the parking lot and find no place to park. So I've decided I need a method to find the closest free parking space to minimise the time spent parking.
### Technical intro
Imagine a representation of a parking lot like this one:
```
*****************
*               *
* ··CC··C··CC·· *
* ************* *
* ··CCCCCCCCC·· *
*               *
**********E******
```
In this representation a `*` means a wall, a `·` a free parking space, a `E` the entry point and a `C` a car already parked. Every whitespace is a position the car to be parked can use to move around the parking lot. Now let's extend this concept to 3D to create a multi-level parking lot:
```
    1st floor            2nd floor            3rd floor            4th floor
*****************    *****************    *****************    *****************
*               1    *               2    *               3    *               *
* CCCCCCCCCCCCC *    * CCCCCCCCCCCCC *    * ····C··CCCCCC *    * ······C······ *
* ************* *    * ************* *    * ************* *    * ************* *
* CCCCCCCCCCCCC *    * CCCCCCCCCCCCC *    * ···CCCCCCCCCC *    * ··C·······C·· *
*               *    *               1    *               2    *               3
**********E******    *****************    *****************    *****************
```
The numbers `1`, `2` and `3` represent the connections between levels. The `1` from the first floor connects with the `1` in the second floor so a car stepping into the `1` position in the first floor appears in the `1` position in the second floor.
### Challenge
Giving a scheme of a parking lot like the previously shown, write the shortest program that calculates the distance to the nearest free parking space, according to the following
### Rules
* The input will be a 3D char array or a 2D string array or equivalent, and the output will be a single integer representing the number of steps the car must take to get to the nearest free parking space. If you receive a 3D char array the first index may represent the floor number and the second and third indices the (x,y) position for each floor, but this is up to you.
* There won't be more than 9 ramps, represented by `[1-9]`.
* The car starts from the `E` position (there will be only one entry point per map) and moves around using the whitespaces in one of four directions each time: up, down, left, right. The car can also step into `·` positions and `[1-9]` positions.
* Every change of position (step) counts as 1, and every time the car goes from one floor to another counts as 3 as the car must take a ramp. In this case, the movement from a whitespace beside a `1` to the `1` itself is what counts as 3 steps, because as a result of this movement the car appears in the `1` position on the other floor.
* The car can't go beyond the matrix limits.
* The count will end when the car to be parked is in the same position as a `·`. If there are no reachable free parking spaces you can return zero, a negative integer, a null value or an error.
### Examples
In the example above the result would be 32, as it is cheaper to go to the fourth floor and park in the closest parking space near the `3`. The nearest free parking spaces in the third floor are at a distance of 33 and 34.
Other examples:
```
    1st floor            2nd floor            3rd floor            4th floor
*****************    *****************    *****************    *****************
*               1    *               2    *               3    *               *
* CCCCCCCCCCCCC *    * CCCCCCCCCCCCC *    * ····C··CCCCCC *    * ······C······ *
* ************* *    * ************* *    * ************* *    * ************* *
* CCCCCCCCCCCCC *    * ·CCCCCCCCCCCC *    * ···CCCCCCCCCC *    * ··C·······C·· *
*               *    *               1    *               2    *               3
**********E******    *****************    *****************    *****************
Answer: 28 (now the parking space in the 2nd floor is closer)
    1st floor            2nd floor            3rd floor            4th floor
*****************    *****************    *****************    *****************
*               1    4               2    5               3    6               *
* CCCCCCCCCCCCC *    * CCCCCCCCCCCCC *    * ····C··CCCCCC *    * ······C······ *
* ************* *    * ************* *    * ************* *    * ************* *
* CCCCCCCCCCCCC *    * CCCCCCCCCCCCC *    * ···CCCCCCCCCC *    * ··C·······C·· *
4               *    5               1    6               2    *               3
**********E******    *****************    *****************    *****************
Answer: 24 (now it's better to go to ramp 4 and then to ramp 5 to the third floor)
    1st floor            2nd floor            3rd floor            4th floor
*****************    *****************    *****************    *****************
*               1    *               *    *               3    *               2
* CCCCCCCCCCCCC *    * CCCCCCCCCCCCC *    * ····C··CCCCCC *    * ······C······ *
* ************* *    * ************* *    * ************* *    * ************* *
* CCCCCCCCCCCCC *    * ·CCCCCCCCCCCC *    * ···CCCCCCCCCC *    * ··C·······C·· *
*               *    *               3    *               2    *               1
**********E******    *****************    *****************    *****************
Answer: 16 (now the parking space in the 4th floor is closer)
 1st floor     2nd floor     3rd floor     4th floor     5th floor
************  ************  ************  ************  ************
*CCCCCCCCC 1  *CCCCCCCCC 2  *CCCCCCCCC 3  *·CCCCCCCC 4  *········C *
*          *  *          *  *          *  *          *  *          *
*CCCCCCCCC E  *CCCCCCCCC 1  *CCCCCCCCC 2  *··CCCCCCC 3  *·······CC 4
************  ************  ************  ************  ************
Answer: 29 (both the nearest parking spaces at the 4th and 5th floors are at the same distance)
 1st floor     2nd floor     3rd floor
************  ************  ************
*CCCCCCCCC 1  *CCCCCCCCC 2  *CCCCCCCCC *
*          *  *          *  *          *
*CCCCCCCCC E  *CCCCCCCCC 1  *CCCCCCCCC 2
************  ************  ************
Answer: -1 (no free parking space)
 1st floor
************
*          *
*          *
*         E*
************
Answer: -1 (no parking space at all)
 1st floor
************
* ·····    *
*·      ****
* ····· * E
*********
Answer: -1 (the parking lot designer was a genius)
```
### Alternatives
* You can use whatever characters you want to represent the parking lot map, just specify in your answer which are your chosen characters and what they mean.
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so may the shortest program/method/lambda/whatever for each language win!
*If you need help with the algorithm, please check [my (ungolfed) implementation in C#](https://tio.run/##7Vhfb9s2EH/3p7j5oZYaWbAkp0Xr2EPgpUGBpA2QrBsQGIUmM4kym/IoOm3W@nP1vV8sI/XHkihRlNyl20MpxJGpu@Pd704/Hu2FfS8g6GEd@vgazu9DipajTv6bOQ0WC@RRP8CheYwwIr4nSJz4@K9Rp4PdJQpXrofgzCV/suevfDxHpPOpA2x4CzcM4YwE18RdRjPxPB8hdanvAUHuPMCLe/AxhdPD39@/Ozz59QjG8CIabAlB4S7w53Dq@lgLKWELXs7AJdehvpXLluDjziWwdP9GzCJGHyDRGRrPZ6OCHJe5HBgwmDHJ7lNxdKulrVgaisOSSNuJ9DQ/QGbbSaQLfkilh61s71f6LZN@JmByJMfEaoWgJUPQlki3QNBqhaDVCkFLhqAlkX7WHBO7FYK2DEFHIp0i@PVLfE2jj5pY7VY42hmOiX0FlLYMSlsi3QJKpxWUjgxKmbQI5RbO9JJqtgDUKQJasJ98lSruN68Mpw7YgviU7QnBApm/EZ8itgsgrfuLz7gZsz2ABnBFEIJVvBdAtDO8hC7swXmwuEMaX0vXBYtlet7nvjfl53pqzspPxcpKGnREi0f1XKwmv0FTwVIwKoKsD8aqCMaqp8VdWKuesLKlVVxVH4xdEYxdz0278EY9ZWREB0MFXSh5xUlNbo1K39lm8QybxjPMxSMQDcgUmoU1LISVsyvBayiJ7TtQ0Q@W@cEy/1OWmf7rJKOA5zEpRtEY7kAtCni@H6ekxjYP6d2K@HcuRekhlh92Y5Wk4zFmkY91p1iCQuZ8tpAB/Kx9FoQ@P6cnU72jnm6@8klItbwjfBBE1wRHZibj3FH7Z@hb8JLP5xzPQGnouQEX69UCHbDnBqQfE65FqCwq/woity8jKfM1RUtGBdkXe5Z7wnM8ht7XLz09DWVQDBAtQlSYKK6WazWniwAn2RpVysg9Ytr1Aub5@o8YGm2Qf@LosFdai4/e0x4roMZGcxaZmlURAC@WDzeIoIvgOGD@8jJ5gz5SoVTi1JTVeVa26uYhvmeVVBL6VBlKkpdM@xzxn5G0FYwnsIqcHhZeFiPq@qsqR1ulOMQ3dnrj6LpunvpYq3B9U5rhNZG6tS35ouKmQdVntR6XTvO31uPy8@LxhuuYx4ieIHxNb7SBboAwZenC8ecqIKDxd89npgYj9u8ASmbY9N5eOVdb3dtY97asy8oIbqt041/xeAiXvgG3EX1203KNZipJJlZpwicnjFwPsgJI/iaTIrmJXOPdRDXu0ouAy6lpk6MvLJXV2kSspf8S7S0pRuiabD@iro9DLRdttWIMf2gezuea9K3iRo1c9szXeI4@vr0qmJduHDskFASoy2zUaB/x1oQgTL8t0ZJsi3zZrlZ4vhLvYqLirFyV83LWcixbl7O8dcaHpcWKU46ucNDJOcjOEYOZGbv4KP4JvkU7lhLAPvOPtSiDx0GsvwNij@qRiFG/jBEjFeR6N6DxWl0xk9m6uqLl2fKJuKHOkpmksWLX58/QRJK3YI0bglo@Um31RhmJmm2@SaQsiT2rB0@eKCM9YJIvGgca5SUIk25L6LQUS6UNO@VdUlIi8NM4Eazq8FpAG4TbdZNbO7vl50A1wBv1bvAQy20e/gE).*

[Answer]
# JavaScript (ES6), 199 bytes
Takes input as an array of arrays of arrays of characters, using the characters described in the challenge. Returns \$0\$ if there's no free parking space.
```
a=>(m=g=(c,t,f,x,y,F=f||a.find(r=>r.some((a,i)=>~(y=i,x=a.indexOf(c)))),r=F[y])=>r&&(c=r[x])&&(r[x]=g,c>'z'?m=m<t?m:t:!f|c<1?[0,-1,0,1].map((d,i)=>g(0,-~t,F,x+d,y+~-i%2)):+c&&g(c,t+2),r[x]=c))('E')|m
```
[Try it online!](https://tio.run/##7VTLboJAFN37FXRRGOA6cbAr4@DC6LYfQFiQ4REaEYOkgYb4W933x@j4BgIW1LYb7yS8Lueec4Z7ebPerTWL/FXcX4a2k7s0t6iOAupRxCAGFxJIYU7dLLOw6y9tFFE9wuswcBCywJepvkEp9SGhFuZpJ3l1EZN5QETnRmryFyJRRIxGRmLK/Gp7ph4wXfqQJgENxvEkGMWjJzdjYzIxBtAnMABi4sBaIWTvKDzEH29imEOi2pCqm77/rMnySGWi6G11qhrn2xbm1EiaSXIW5CxcrsOFgxehh1xkGD1BMDDGklINyYRTTigHKeWmxRDKuFLFSu4Srhyl3ClmR509E66yof2xDVJrQ7nVxrCU@/rcr@nu0NXMAdvOj/Y7fpRaPydPx9XRVQl7uBVab2udO1OWe49pavhs19ooNt8PPoaPcer@l/u3cSL3GqdinfPGknrqhrdnDWKad7m@jtaJldyJddiJVbuJ9dy9wksL2kK7N85nW@JKhzV11wVUVfQdOq4wQDXkB0UXMArvPaFGksRxe0n5Nw "JavaScript (Node.js) – Try It Online")
### How?
The recursive function **g()** takes as input:
* **c** : the character of the entry point we're looking for if we've just left a floor or we are at the very beginning of the process; **0** otherwise
* **t** : the total number of moves so far (initially *undefined*)
* **f**, **x**, **y** : a pointer to the current floor and the current coordinates in this floor; they are all *undefined* if we're looking for a new floor
If **f** is defined, we simply copy it to the current floor **F**. Otherwise, we need to look for the new floor and the new coordinates by iterating over each floor and over each row until we find the entry point **c**:
```
F = f || a.find(r => r.some((a, i) => ~(y = i, x = a.indexOf(c))))
```
We define **r** as the current row in the current floor:
```
r = F[Y]
```
The next step is to make sure that the current cell **c** at **(x, y)** is defined:
```
r && (c = r[x]) && ...
```
If it is, we mark it as visited by setting it to **g**, a value that does not trigger any of the forthcoming tests:
```
r[x] = g
```
If **c** is a free parking space, we stop the recursion. And if the total number of moves is lower than our previous best score, we update **m** accordingly:
```
c > 'z' ? m = m < t ? m : t : ...
```
If we've just reached a new floor (**f** is *undefined*) or **c** is a space, we process a recursive call for each surrounding cell:
```
!f | c < 1 ?
  [0, -1, 0, 1].map((d, i) =>
    g(0, -~t, F, x + d, y + ~-i % 2)
  )
:
  ...
```
Otherwise, if **c** is a ramp marker (i.e. a non-zero digit), we process a single recursive call to reach the new floor:
```
+c && g(c, t + 2)
```
Finally, we restore the current cell to its initial value so that it can be visited again in other recursion paths:
```
r[x] = c
```
[Answer]
# Powershell, ~~299~~ 292 bytes
It is assumed that the [map is rectangle](https://www.youtube.com/watch?v=OoYeDq-KmqM).
It uses `x` instead `·`. To get `·`, you need to save script as ASCII (not UTF-8) and replace `x` on `·`.
```
filter f{$l=($_-split"
")[0].length
$p,$d,$e='x','\d',' '|%{"$_(?=E)|(?<=E)$_|$_(?=[\s\S]{$l}E)|(?<=E[\s\S]{$l})$_"}
for($r=1;$_-notmatch$p;$r++){$m=$_-replace'F','E'-replace'G','F'-replace'H','G'
if($m-match$d){$m=$m-replace$Matches[0],'H'}$m=$m-replace$e,'E'
if($m-eq$_){return -1}$_=$m}$r}
```
Ungolfed and test script:
```
filter f{
    #Write-Host "`nStep:`n$_" # uncomment this to display each step
    $l = ($_ -split "`n")[0].length
    $p,$d,$e = 'x', '\d', ' '| % {"$_(?=E)|(?<=E)$_|$_(?=[\s\S]{$l}E)|(?<=E[\s\S]{$l})$_"}
    for($r = 1;$_ -notmatch $p;$r++) {
        $m = $_ -replace 'F', 'E' -replace 'G', 'F' -replace 'H', 'G'
        if ($m -match $d) {
            $m = $m -replace $Matches[0], 'H'
        }
        $m = $m -replace $e, 'E'
        if ($m -eq $_) {
            return -1
        }
        $_=$m
    }
    $r
}
@(
    , (2, @"
****
*x E
****
"@)
    , (1, @"
****
* xE
****
"@)
    , (1, @"
****
* x*
* E*
****
"@)
    , (1, @"
****
* E*
* x*
****
"@)
    , (-1, @"
****
2 E1
*  *
****
"@)
    , (28, @"
*****************
*               1
* CCCCCCCCCCCCC *
* ************* *
* CCCCCCCCCCCCC *
*               *
**********E******
*****************
*               2
* CCCCCCCCCCCCC *
* ************* *
* xCCCCCCCCCCCC *
*               1
*****************
*****************
*               3
* xxxxCxxCCCCCC *
* ************* *
* xxxCCCCCCCCCC *
*               2
*****************
*****************
*               *
* xxxxxxCxxxxxx *
* ************* *
* xxCxxxxxxxCxx *
*               3
*****************
"@)
    , (16, @"
*****************
*               1
* CCCCCCCCCCCCC *
* ************* *
* CCCCCCCCCCCCC *
*               *
**********E******
*****************
*               *
* CCCCCCCCCCCCC *
* ************* *
* xCCCCCCCCCCCC *
*               3
*****************
*****************
*               3
* xxxxCxxCCCCCC *
* ************* *
* xxxCCCCCCCCCC *
*               2
*****************
*****************
*               2
* xxxxxxCxxxxxx *
* ************* *
* xxCxxxxxxxCxx *
*               1
*****************
"@)
    , (29, @"
************
*CCCCCCCCC 1
*          *
*CCCCCCCCC E
************
************
*CCCCCCCCC 2
*          *
*CCCCCCCCC 1
************
************
*CCCCCCCCC 3
*          *
*CCCCCCCCC 2
************
************
*xCCCCCCCC 4
*          *
*xxCCCCCCC 3
************
************
*xxxxxxxxC *
*          *
*xxxxxxxCC 4
************
"@
    )
    , (-1, @"
************
*          *
*          *
*         E*
************
"@)
    , (-1, @"
************
* xxxxx    *
*x      ****
* xxxxx * E
*********
"@)
) | % {
    $e, $m = $_
    $r = $m|f
    "$($e-eq$r): $r $e"
}
```
Output:
```
True: 2 2
True: 1 1
True: 1 1
True: 1 1
True: -1 -1
True: 28 28
True: 16 16
True: 29 29
True: -1 -1
True: -1 -1
```
Extended output for parking with 16 steps:
```
Step:
*****************
*               1
* CCCCCCCCCCCCC *
* ************* *
* CCCCCCCCCCCCC *
*               *
**********E******
*****************
*               *
* CCCCCCCCCCCCC *
* ************* *
* xCCCCCCCCCCCC *
*               3
*****************
*****************
*               3
* xxxxCxxCCCCCC *
* ************* *
* xxxCCCCCCCCCC *
*               2
*****************
*****************
*               2
* xxxxxxCxxxxxx *
* ************* *
* xxCxxxxxxxCxx *
*               1
*****************
Step:
*****************
*               1
* CCCCCCCCCCCCC *
* ************* *
* CCCCCCCCCCCCC *
*         E     *
**********E******
*****************
*               *
* CCCCCCCCCCCCC *
* ************* *
* xCCCCCCCCCCCC *
*               3
*****************
*****************
*               3
* xxxxCxxCCCCCC *
* ************* *
* xxxCCCCCCCCCC *
*               2
*****************
*****************
*               2
* xxxxxxCxxxxxx *
* ************* *
* xxCxxxxxxxCxx *
*               1
*****************
Step:
*****************
*               1
* CCCCCCCCCCCCC *
* ************* *
* CCCCCCCCCCCCC *
*        EEE    *
**********E******
*****************
*               *
* CCCCCCCCCCCCC *
* ************* *
* xCCCCCCCCCCCC *
*               3
*****************
*****************
*               3
* xxxxCxxCCCCCC *
* ************* *
* xxxCCCCCCCCCC *
*               2
*****************
*****************
*               2
* xxxxxxCxxxxxx *
* ************* *
* xxCxxxxxxxCxx *
*               1
*****************
Step:
*****************
*               1
* CCCCCCCCCCCCC *
* ************* *
* CCCCCCCCCCCCC *
*       EEEEE   *
**********E******
*****************
*               *
* CCCCCCCCCCCCC *
* ************* *
* xCCCCCCCCCCCC *
*               3
*****************
*****************
*               3
* xxxxCxxCCCCCC *
* ************* *
* xxxCCCCCCCCCC *
*               2
*****************
*****************
*               2
* xxxxxxCxxxxxx *
* ************* *
* xxCxxxxxxxCxx *
*               1
*****************
Step:
*****************
*               1
* CCCCCCCCCCCCC *
* ************* *
* CCCCCCCCCCCCC *
*      EEEEEEE  *
**********E******
*****************
*               *
* CCCCCCCCCCCCC *
* ************* *
* xCCCCCCCCCCCC *
*               3
*****************
*****************
*               3
* xxxxCxxCCCCCC *
* ************* *
* xxxCCCCCCCCCC *
*               2
*****************
*****************
*               2
* xxxxxxCxxxxxx *
* ************* *
* xxCxxxxxxxCxx *
*               1
*****************
Step:
*****************
*               1
* CCCCCCCCCCCCC *
* ************* *
* CCCCCCCCCCCCC *
*     EEEEEEEEE *
**********E******
*****************
*               *
* CCCCCCCCCCCCC *
* ************* *
* xCCCCCCCCCCCC *
*               3
*****************
*****************
*               3
* xxxxCxxCCCCCC *
* ************* *
* xxxCCCCCCCCCC *
*               2
*****************
*****************
*               2
* xxxxxxCxxxxxx *
* ************* *
* xxCxxxxxxxCxx *
*               1
*****************
Step:
*****************
*               1
* CCCCCCCCCCCCC *
* ************* *
* CCCCCCCCCCCCC *
*    EEEEEEEEEEE*
**********E******
*****************
*               *
* CCCCCCCCCCCCC *
* ************* *
* xCCCCCCCCCCCC *
*               3
*****************
*****************
*               3
* xxxxCxxCCCCCC *
* ************* *
* xxxCCCCCCCCCC *
*               2
*****************
*****************
*               2
* xxxxxxCxxxxxx *
* ************* *
* xxCxxxxxxxCxx *
*               1
*****************
Step:
*****************
*               1
* CCCCCCCCCCCCC *
* ************* *
* CCCCCCCCCCCCCE*
*   EEEEEEEEEEEE*
**********E******
*****************
*               *
* CCCCCCCCCCCCC *
* ************* *
* xCCCCCCCCCCCC *
*               3
*****************
*****************
*               3
* xxxxCxxCCCCCC *
* ************* *
* xxxCCCCCCCCCC *
*               2
*****************
*****************
*               2
* xxxxxxCxxxxxx *
* ************* *
* xxCxxxxxxxCxx *
*               1
*****************
Step:
*****************
*               1
* CCCCCCCCCCCCC *
* *************E*
* CCCCCCCCCCCCCE*
*  EEEEEEEEEEEEE*
**********E******
*****************
*               *
* CCCCCCCCCCCCC *
* ************* *
* xCCCCCCCCCCCC *
*               3
*****************
*****************
*               3
* xxxxCxxCCCCCC *
* ************* *
* xxxCCCCCCCCCC *
*               2
*****************
*****************
*               2
* xxxxxxCxxxxxx *
* ************* *
* xxCxxxxxxxCxx *
*               1
*****************
Step:
*****************
*               1
* CCCCCCCCCCCCCE*
* *************E*
* CCCCCCCCCCCCCE*
* EEEEEEEEEEEEEE*
**********E******
*****************
*               *
* CCCCCCCCCCCCC *
* ************* *
* xCCCCCCCCCCCC *
*               3
*****************
*****************
*               3
* xxxxCxxCCCCCC *
* ************* *
* xxxCCCCCCCCCC *
*               2
*****************
*****************
*               2
* xxxxxxCxxxxxx *
* ************* *
* xxCxxxxxxxCxx *
*               1
*****************
Step:
*****************
*              E1
* CCCCCCCCCCCCCE*
* *************E*
* CCCCCCCCCCCCCE*
*EEEEEEEEEEEEEEE*
**********E******
*****************
*               *
* CCCCCCCCCCCCC *
* ************* *
* xCCCCCCCCCCCC *
*               3
*****************
*****************
*               3
* xxxxCxxCCCCCC *
* ************* *
* xxxCCCCCCCCCC *
*               2
*****************
*****************
*               2
* xxxxxxCxxxxxx *
* ************* *
* xxCxxxxxxxCxx *
*               1
*****************
Step:
*****************
*             EEH
* CCCCCCCCCCCCCE*
* *************E*
*ECCCCCCCCCCCCCE*
*EEEEEEEEEEEEEEE*
**********E******
*****************
*               *
* CCCCCCCCCCCCC *
* ************* *
* xCCCCCCCCCCCC *
*               3
*****************
*****************
*               3
* xxxxCxxCCCCCC *
* ************* *
* xxxCCCCCCCCCC *
*               2
*****************
*****************
*               2
* xxxxxxCxxxxxx *
* ************* *
* xxCxxxxxxxCxx *
*               H
*****************
Step:
*****************
*            EEEG
* CCCCCCCCCCCCCE*
*E*************E*
*ECCCCCCCCCCCCCE*
*EEEEEEEEEEEEEEE*
**********E******
*****************
*               *
* CCCCCCCCCCCCC *
* ************* *
* xCCCCCCCCCCCC *
*               3
*****************
*****************
*               3
* xxxxCxxCCCCCC *
* ************* *
* xxxCCCCCCCCCC *
*               2
*****************
*****************
*               2
* xxxxxxCxxxxxx *
* ************* *
* xxCxxxxxxxCxx *
*               G
*****************
Step:
*****************
*           EEEEF
*ECCCCCCCCCCCCCE*
*E*************E*
*ECCCCCCCCCCCCCE*
*EEEEEEEEEEEEEEE*
**********E******
*****************
*               *
* CCCCCCCCCCCCC *
* ************* *
* xCCCCCCCCCCCC *
*               3
*****************
*****************
*               3
* xxxxCxxCCCCCC *
* ************* *
* xxxCCCCCCCCCC *
*               2
*****************
*****************
*               2
* xxxxxxCxxxxxx *
* ************* *
* xxCxxxxxxxCxx *
*               F
*****************
Step:
*****************
*E         EEEEEE
*ECCCCCCCCCCCCCE*
*E*************E*
*ECCCCCCCCCCCCCE*
*EEEEEEEEEEEEEEE*
**********E******
*****************
*               *
* CCCCCCCCCCCCC *
* ************* *
* xCCCCCCCCCCCC *
*               3
*****************
*****************
*               3
* xxxxCxxCCCCCC *
* ************* *
* xxxCCCCCCCCCC *
*               2
*****************
*****************
*               2
* xxxxxxCxxxxxx *
* ************* *
* xxCxxxxxxxCxx *
*              EE
*****************
Step:
*****************
*EE       EEEEEEE
*ECCCCCCCCCCCCCE*
*E*************E*
*ECCCCCCCCCCCCCE*
*EEEEEEEEEEEEEEE*
**********E******
*****************
*               *
* CCCCCCCCCCCCC *
* ************* *
* xCCCCCCCCCCCC *
*               3
*****************
*****************
*               3
* xxxxCxxCCCCCC *
* ************* *
* xxxCCCCCCCCCC *
*               2
*****************
*****************
*               2
* xxxxxxCxxxxxx *
* ************* *
* xxCxxxxxxxCxxE*
*             EEE
*****************
True: 16 16
```
## Explanation
It's kind of [Lee pathfinding algorithm](https://en.wikipedia.org/wiki/Lee_algorithm). Only one smart thing: 3 steps on ramp are realized as a dummy states `H->G->F->E`
---
# Powershell for a genius parking lot designer, ~~377~~ 369 bytes
Parking design is an `2D string array`. No assumtions about map: any length strings, floors without walls, parking without an entry point, multi-floor-and-multi-exit-ramps. Genus cost is +26%.
```
filter f{for($r=1;$_-notmatch$p;$r++){$m=$_-replace'F','E'-replace'G','F'-replace'H','G'
if($m-match$d){$m=$m-replace$Matches[0],'H'}$m=$m-replace$e,'E'
if($m-eq$_){return-1}$_=$m}$r}$g={$l=($args|%{$_|%{$_.length}}|sort)[-1]
$p,$d,$e='x','\d',' '|%{"$_(?=E)|(?<=E)$_|$_(?=[\s\S]{$l}E)|(?<=E[\s\S]{$l})$_"}
(($args|%{$_.PadRight($l,'*')-join"
"})-join"
"+'-'*$l+"
")|f}
```
Ungolfed and test script:
```
filter f{
    #Write-Host "`nStep:`n$_" # uncomment this to display each step
    for($r = 1;$_ -notmatch $p;$r++) {
        $m = $_ -replace 'F', 'E' -replace 'G', 'F' -replace 'H', 'G'
        if ($m -match $d) {
            $m = $m -replace $Matches[0], 'H'
        }
        $m = $m -replace $e, 'E'
        if ($m -eq $_) {
            return -1
        }
        $_=$m
    }
    $r
}
$g = {
    $l = ($args| % {$_| % {$_.length}}|sort)[-1]
    $p,$d,$e = 'x', '\d', ' '| % {"$_(?=E)|(?<=E)$_|$_(?=[\s\S]{$l}E)|(?<=E[\s\S]{$l})$_"}
    (($args| % {$_.PadRight($l, '*') -join "`n"}) -join "`n"+'-' * $l+"`n")|f
}
@(
    , (2, @(, (
                "****",
                "*x E",
                "****"
            )))
    , (1, @(, (
                "****",
                "* xE",
                "****"
            )))
    , (1, @(, (
                "****",
                "* x*",
                "* E*",
                "****"
            )))
    , (1, @(, (
                "****",
                "* E*",
                "* x*",
                "****"
            )))
    , (-1, @(, (
                "****",
                "2 E1",
                "*  *",
                "****"
            )))
    , (28, @(, (
                "*****************",
                "*               1",
                "* CCCCCCCCCCCCC *",
                "* ************* *",
                "* CCCCCCCCCCCCC *",
                "*               *",
                "**********E******"
            ), (
                "*****************",
                "*               2",
                "* CCCCCCCCCCCCC *",
                "* ************* *",
                "* xCCCCCCCCCCCC *",
                "*               1",
                "*****************"
            ), @(
                "*****************",
                "*               3",
                "* xxxxCxxCCCCCC *",
                "* ************* *",
                "* xxxCCCCCCCCCC *",
                "*               2",
                "*****************"
            ), @(
                "*****************",
                "*               *",
                "* xxxxxxCxxxxxx *",
                "* ************* *",
                "* xxCxxxxxxxCxx *",
                "*               3",
                "*****************"
            )))
    , (16, @(, (
                "*****************",
                "*               1",
                "* CCCCCCCCCCCCC *",
                "* ************* *",
                "* CCCCCCCCCCCCC *",
                "*               *",
                "**********E******"
            ), @(
                "*****************",
                "*               *",
                "* CCCCCCCCCCCCC *",
                "* ************* *",
                "* xCCCCCCCCCCCC *",
                "*               3",
                "*****************"
            ), @(
                "*****************",
                "*               3",
                "* xxxxCxxCCCCCC *",
                "* ************* *",
                "* xxxCCCCCCCCCC *",
                "*               2",
                "*****************"
            ), @(
                "*****************",
                "*               2",
                "* xxxxxxCxxxxxx *",
                "* ************* *",
                "* xxCxxxxxxxCxx *",
                "*               1",
                "*****************"
            )))
    , (29, @(, (
                "************",
                "*CCCCCCCCC 1",
                "*          *",
                "*CCCCCCCCC E",
                "************"
            ), @(
                "************",
                "*CCCCCCCCC 2",
                "*          *",
                "*CCCCCCCCC 1",
                "************"
            ), @(
                "************",
                "*CCCCCCCCC 3",
                "*          *",
                "*CCCCCCCCC 2",
                "************"
            ), @(
                "************",
                "*xCCCCCCCC 4",
                "*          *",
                "*xxCCCCCCC 3",
                "************"
            ), @(
                "************",
                "*xxxxxxxxC *",
                "*          *",
                "*xxxxxxxCC 4",
                "************"
            )))
    , (-1, @(, (
                "************",
                "*          *",
                "*          *",
                "*         E*",
                "************"
            )))
    , (-1, @(, (
                "************",
                "* xxxxx    *",
                "*x      ****",
                "* xxxxx * E",
                "*********"
            )))
) | % {
    $e, $m = $_
    $r = &$g @m
    "$($e-eq$r): $r $e"
}
```
[Answer]
# [Kotlin](https://kotlinlang.org), 768 bytes
used period . instead of ·. Wish I understood Arnauld's answer because losing 500 bytes would be nice.
```
fun s(l:List<List<CharArray>>)={val b=listOf(l.size-1,l[0].size-1,l[0][0].size-1)
val e=Int.MAX_VALUE
var r=e
var t=listOf(e,e,e)
val d=Array(b[0]+1){Array(b[1]+1){Array(b[2]+1){e}}}
val f={c:Char,n:List<Int>->var a=t
(0..b[0]).map{f->(0..b[1]).map{r->(0..b[2]).map{var s=listOf(f,r,it)
if(l[f][r][it]==c&&!s.equals(n))a=s}}}
a}
fun m(p:List<Int>,c:Int){if(p[0]in 0..b[0]&&p[1]in 0..b[1]&&p[2]in 0..b[2]&&d[p[0]][p[1]][p[2]]>c){d[p[0]][p[1]][p[2]]=c
val h=l[p[0]][p[1]][p[2]]
when(h){' ','E'->(-1..1 step 2).map{m(listOf(p[0],p[1]+it,p[2]),c+1)
m(listOf(p[0],p[1],p[2]+it),c+1)}
'.'->if(r>c)r=c
in '1'..'9'->{val n=f(h,p)
d[n[0]][n[1]][n[2]]=c+2
(-1..1 step 2).map{m(listOf(n[0],n[1]+it,n[2]),c+3)
m(listOf(n[0],n[1],n[2]+it),c+3)}}}}}
m(f('E',t),0)
if(r<e)r
else-1}()
```
[Try it online!](https://tio.run/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