text:
Crazy 8s Code Golf
Create a program that prints all whole numbers inclusively between an interval (a, b), and replaces multiples of 8 in the sequence with random (uniformly distributed, independent of other characters), non-numeric, non-whitespace, printable ASCII characters.
Assume 0 < a < b in all cases.
If the number has more than 1 digit, make sure the amount of characters in the replacement matches!
Examples:
(1, 16) -> 1 2 3 4 5 6 7 $ 9 10 11 12 13 14 15 n@

(115, 123) -> 115, 116, 117, 118, 119, :F<, 121, 122, 123

(1, 3) -> 1 2 3

Non-Examples:
(1, 16) -> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

(115, 123) -> 115 116 117 118 119 $ 121 122 123

This is code golf, so the shortest code in bytes wins!
Current Winner:
 Pyke (21 bytes) by muddyfish
Most Popular:
 Python 2 (119 bytes) by Dennis

Congrats on making a challenge that combines all the super long things to implement in my golfing language

@muddyfish i mean it is a challenge ;)

I'm not sure if I am missing something, but should the random characters be unique or not? For example if the input was 16, 16 then could the output be aa? If this is not the case, what about if the number has more than 85 digits (assuming I counted correctly)?

@FryAmTheEggman each character should be unique mostly but if "a" and "a" are randomly selected consecutively that is ok, but it shouldnt happen in all cases because the probability is so low

@FryAmTheEggman and the case 16, 16 in the other examples either returns 0 or 2 random characters but dont worry about that case as a will always strictly be less than b

What do we do with non-ASCII encodings?

Can we choose such random chars (guaranteed to be random): http://xkcd.com/221/ ?

Can 8 be randomly selected?

@steenbergh no, random characters must be non-nuneric

@Caleb Hmm, missed that bit of the specs. That's expensive...

Pyke, 22 21 bytes
h1:Fi8%!I`lV~Kl7T>Hs0

Try it here!
Takes input in the form: higher, lower
h1:                   -  range(lower, higher+1, 1)
   F                  - for i in ^:
    i8%               -    i % 8
       !              -   not ^
        I             -  if ^:
         `l           -    len(str(i))
           V          -   repeat V ^ times
            ~K        -        printable_ascii
              l7      -       ^.strip()
                T>    -      ^[10:]
                  H   -     random.choice(^)
                   s0 -    sum(^)

Lists are all good!

This is interesting, the first case ive seen where 8n, 8n causes an error

my bad I misread the output

Python 2, 126 bytes
Try it online!
import random,string
def f(a,b):
 while b/a:print[a,eval('random.choice(string.printable[10:-6])+'*len(`a`)+"''")][a%8<1];a+=1

Many thanks to Flp.Tkc and EasterlyIrk for all of their help!

You can use b/a instead of a<=b and you don't need the ; at the end. Also import random,string saves a few bytes. https://tio.run/nexus/python2#TcvdCoIwGAbg813FEGJbW9anJGF1JSL4qVsO5pQldflL9KTD9@eJdpynsNCAvp9G9V6C9S/Sa0MNR9WKktDvYJ2m7RnLeR2XCpX@oONsJ2k3TLbTfJfpdsHW6Qou5amohWRHpz1vsBEyYSwRdYWH2wPqO8onRMNBQSHI5sia4Kogy/8KlYv4Aw

@Dennis, thank you, that took off 7 bytes!

Python 2, 119 bytes
import random,string
def f(a,b):print`[random.choice(string.printable[10:95])for _ in`a`]`[2+a%8*b::5]or a;a<b<f(a+1,b)

Try it online!

To quote Flp.Tkc: "One does not simply outgolf Dennis"

zsh, 100 98 bytes
for i in {$1..$2};{((i%8))&&<<<$i||<<<`yes 'shuf -e {!..~}|grep "[^0-9]"|head -c1'|head -$#i|zsh`}

The two input arguments are passed as command line arguments, and the numbers are output on separate lines.
for i in {$1..$2};{   # loop through the range
((i%8))&&             # if the number is not divisible by 8 (i % 8 != 0),
<<<$i||               # output it
<<<`                  # otherwise, output the following:
yes '                 # using `yes' as a golfy loop
shuf -e {\!..\~}      # shuffle the range of printable ASCII (minus space)
|grep "[^0-9]"        # get rid of numbers
|head -c1'            # take the first character
|head -$#i            # obtain a string with that code repeated len(i) times...
|zsh                  # ... and eval it
`}

May I ask why you are outputting the numbers that are divisible by 8?

@Caleb Whoops, that was a typo. It was meant to read "not divisible by 8."

Mathematica, 96 bytes
Range@##/.a_?(8∣#&):>Join[33~(c=CharacterRange)~47,58~c~127]~RandomChoice~⌊Log10@a+1⌋<>""&

Explanation
For inputs m and n:
Range@##

Generate {m, m + 1, m + 2, ... , n}
/.a_?(8∣#&):>

For all numbers that are divisible by 8 (call that a), apply this replacement rule:
Join[33~(c=CharacterRange)~47,58~c~127]

Get a list of all printable ASCII characters, except digits.
... ~RandomChoice~⌊Log10@a+1⌋

Pseudo-randomly choose Floor[Log10[a] + 1] characters from the list, allowing duplicates.
<>""

Join the characters.

another approach for 96 bytes using FromCharacterCode (r=Range)@##/.a_?(8∣#&):>FromCharacterCode[Join[33~r~47,58~r~127]~RandomChoice~⌊Log10@a+1⌋]<>""&

R, 73 bytes
i=scan();x=i[1]:i[2];x[!x%%8]=sample(sapply(c(32:46,58:126),intToUtf8));x

Reads input from stdin and replaces replaces numbers divisible by 8 with a uniformly chosen sample of ascii characters in the range 32...47, 58...126. To draw the random sample we need a vector of characters, unfortunately intToUtf8() returns one string rather than a vector so we also have to vectorize it over the range using sapply.

Python 2, 126 bytes
(one does not simply outgolf Dennis)
Seeing as I did a lot of work on heather's answer, I thought I'd post my own solutions too.
import random,string
def f(a,b):
 while b/a:print[a,eval('random.choice(string.printable[10:-6])+'*len(`a`)+"''")][a%8<1];a+=1

This is a function which takes two arguments and prints directly to STDOUT.
127 bytes
import random,string
lambda a,b:[[x,eval('random.choice(string.printable[10:-6])+'*len(`x`)+`''`)][x%8<1]for x in range(a,b+1)]

This is an unnamed anonymous function - to use, assign to a variable (such as f), and then call with f(a, b). This returns the output as a list.

This is incorrect. The randomly selected characters may not contain digits.

@Dennis alright, back to my splicing idea :P Thanks for the heads up

Python 2 seems to be popular contender, i love it!

Pip, 28 bytes
Fia,b+1Pi%8?i{RC@>PA@`\D`}Mi

Takes the numbers as command-line arguments and prints a newline-separated list of results. Try it online!
Explanation:
                              a,b are cmdline args; PA is string of all printable ASCII
Fia,b+1                       For i in range(a, b+1):
       P                       Print this:
        i%8?i                  If i%8 is truthy (nonzero), i; otherwise:
             {           }Mi   Map this function to the digits of i:
                @>PA           All but the first character of PA (removes space)
                    @`\D`      Find all regex matches of \D (nondigits)
              RC               Random choice from that list of characters
                               The map operation returns a list, which is concatenated
                               before printing

JavaScript (ES6), 114 bytes

f=(x,y)=>(x+"").replace(/./g,d=>x%8?d:String.fromCharCode((q=Math.random()*84)+(q>15?43:33)))+(x<y?[,f(x+1,y)]:"")

O.textContent = f(1,200)
<pre id=O>

Those darn built-ins with 23-byte names....

The replacement chars should be non-numerical

@LarsW Somehow missed that, thanks

Bash + apg, 64, 76, 73 bytes
EDITS:

Fixed the "8 8" issue, exclude numeric characters from a set of random chars, +12 bytes

-3 bytes, replaced $1 $2 with $@, thx @pxeger

Golfed
seq $@|sed "$[(7&(8-$1%8))+1]~8s/.*/a=&;apg -a1 -n1 -Mcsl -m\${#a} -x0/e"

Test
>./crazy8 8 8
$

>./crazy8 115 123
115
116
117
118
119
As_
121
122
123

>./crazy8 1 16
1
2
3
4
5
6
7
"
9
10
11
12
13
14
15
x!

Could you give is a brief walk through? Also im curious to see what crazy8 8 8 would yield

@Caleb, actually it will just output a as is, for 8 8, looks like I've over-golfed it a bit, working on a fix now. It also does not filter out digits from the random string character set (I've missed that too).

can't you replace $1 $2 with $@?

@pxeger True, thank you !

MATL, 26 bytes
&:"@8\?@}6Y24Y2X-Xz@VnT&Zr

Try it online!
Explanation
&:        % Input a and b (implicit). Push range [a a+1 ... b]
"         % For each k in that range
  @       %   Push k
  8\      %   Modulo 8
  ?       %   If non-zero
    @     %     Push k
  }       %   Else
    6Y2   %     Push string of all printable ASCII chars
    4Y2   %     Push string '0123456789'
    X-    %     Set difference
    Xz    %     Remove space. Gives string of possible random chars
    @Vn   %     Push number of digits of k
    T&Zr  %     Random sample with replacement of that many chars from the string
          % End if, end for each, display (implicit)

Wow, cool! Nice answer. +1

@heather Thanks! I have a feeling it could be made shorter...

Pyth, 24 bytes
jm?%d8dsmO-r\~\ jkUT`d}F

Try it online!
Explanation:
jm?%d8dsmO-r\~\ jkUT`d}FQ  # Auto-fill variables
                      }FQ  # Splat inclusive range on the input
 m?%d8d                    # Map over each number, if it isn't divisible by 8 return it
       smO          `d     # for each other number, select a character at random for
                             each of it's digits and then flatten into one string
           r\~\            # Printable ASCII excluding space
          -     jkUT       # Setwise difference with numeric values (remove numbers)
j                          # Join with newlines

Perl 6, 60 bytes
{map {$_%8??$_!!S:g/./{grep(/\D/,"!".."~").pick}/},$^a..$^b}

Explanation:

{ map {  }, $^a .. $^b }: A lambda that takes two arguments, generates the list of integers in that range, and returns it with the following transformation applied to each element:
$_ % 8 ?? $_ !!: If the element is not divisible by 8, pass it on unchanged. Otherwise...
S:g/./{  }/: ...replace each character of its string representation with the value generated by this expression:
grep(/\D/, "!" .. "~").pick: Generate the range of characters between ! and ~ (in Unicode order), filter out digits, and randomly pick one of the remaining characters.

Inlined version
Scala, 132 bytes
def S(a:Int,b:Int)= a to b map(x=>if(x%8==0)Random.nextInt(((33 to 47)++(58 to 126)).length).toChar.toString else String.valueOf(x))

Try it online!
Scala, 198 bytes
An improved functional version with immutable state (03-04-2018)
  def S(a: Int, b: Int)={
    val c=(33 to 47)++(58 to 126)
    val r = (a to b).toStream.map {case x if x%8==0=>c(Random.nextInt(c.length)).toChar.toString
      case x => String.valueOf(x)}
    r}

Try it online!
A functional style solution in Scala (350 bytes)
for the fun of it.
def r(a:Int, b:Int)={
    var l=(33 to 47).toList:::(58 to 126).toList
    l=Random.shuffle(l)
    var x=ListBuffer[String]()
    var k=0
    (a to b).toList.foreach{e=>{
         if(k==l.length){k=0
         l=Random.shuffle(l)}
         if (e.toInt%8==0){x+=l(k).toChar.toString
           k+=1}
         else{x+=e.toString
             k+=1}}}
    x}

Suggestions for improvements are welcomed.

Here on code golf se we only allow answers which have been at least attempted to be golfed. This means 1 character variable names and removal of spaces android adding a byte count to your answer

@muddyfish ok i golfed my code, how is android adding the byte count ?

It seems fine to me right now

Perl, 66 bytes
map{$_%8||s%.%do{$_=chr rand 126}until/[!-\/:-~]/;$_%ge;say}<>..<>

Run with -E flag:
perl -E 'map{$_%8||s%.%do{$_=chr rand 126}until/[!-\/:-~]/;$_%ge;say}<>..<>' <<< "8
16"

This is pretty straight forward:
-<>..<> creates a list of the numbers between the 2 inputs number. And then map iterates over it:
-$_%8||... : the ... are executed only if $_ is a multiple of 8.
-s%.%xxx%ge : replace every character with xxx.
- do{$_=chr rand 126}until/[!-\/:-~]/ pick a random character (from codes 0 to 126) until we get one that satisfies /[!-\/:-~]/, ie. one that is printable and is not a digit.
- say: print it.

Java 10, 149 147 bytes (lambda function)
b->a->{var r="";for(;a<=b;r+=" ",a++)for(var c:(a+"").split("")){char t=0;for(;t<33|t>126|t>47&t<59;t*=Math.random())t=127;r+=a%8<1?t:c;}return r;}

Try it online.
Java 10, 227 225 bytes (full program)
interface M{static void main(String[]A){var r="";for(var a=new Long(A[0]);a<=new Long(A[1]);r+=" ",a++)for(var c:(a+"").split("")){char t=0;for(;t<33|t>126|t>47&t<59;t*=Math.random())t=127;r+=a%8<1?t:c;}System.out.print(r);}}

Try it online.
Explanation:
b->a->{          // Method with two integer parameters and String return-type
  var r="";      //  Result-String, starting empty
  for(;a<=b      //  Loop as long as `a` is smaller than or equal to `b`
      ;          //    After every iteration:
       r+=" ",   //     Append a space to the result-String
       a++)      //     And increase `a` by 1
    for(var c:(a+"").split("")){
                 //   Inner loop over the characters of the current number
      char t=0;  //    Random-char, starting at 0
      for(;t<33|t>126|t>47&t<59;
                 //    Loop until `t` is a non-digit printable ASCII char
          t*=Math.random())t=127;
                 //     Set `t` to a random character with a unicode in the range [0,127)
      r+=a%8<1?  //   If the current `a` is divisible by 8:
          t      //    Append the random character
         :       //   Else:
          c;}    //    Append the digit instead
  return r;}     //  Return the result

range [0,127] does not conform to spec: "non-numeric, non-whitespace, printable ASCII"

@O.O.Balance Maybe my comment isn't very well explained, but that's where the t<33|(t>47&t<59)|t>126; is for above it. It basically generated a random number in the range [0,127), then checks if it's valid (so in the range [33..47,59..126], all printable non-digit ASCII characters). If it is: good, append it. If not: generate a random number in the range [0,127) again and validate it again until we've found a valid character.

No, I think your comment is fine. My bad :)

C, 157 115 bytes
f(a,b){b-a&&f(a,b-1);if(b%8)printf("%d",b);else for(;b;b/=10){while(isdigit(a=rand()%94+33));putchar(a);}puts("");}

Try it online here. Thanks to jxh for golfing 42 bytes.
Ungolfed version:
f(a, b) { // recursive function, parameters are implicitly int
    b-a && f(a, b-1); // recurse until a = b
    if(b % 8)            // if the number is a multiple of 8
        printf("%d", b); // simply print it
    else for(; b; b /= 10) { // while b > 0, lop off the last digit
        while(isdigit(a = rand() % 94 + 33)); // generate random characters in ASCII range [33, 127] until one is non-numeric
        putchar(a); // print the character
    }
    puts(""); // print a newline
}

This conversation can be continued in chat.

113 bytes

C (gcc), 129 119 bytes
s(a,r){a&&s(!isdigit(r=rand()%94+33)?putchar(r),a/10:a,0);}f(a,b){b>a&&f(a,b-1);b%8?printf("%d",b):s(b,0);printf(" ");}

Try it online!
129 → 119 Use the %94+33 trick from O.O.Balance
Ungolfed:
s(a,r){
    a&&                                  // Loop recursively on a!=0
    s(!isdigit(r=rand()%94+33)           // Test random selection
      ?putchar(r),a/10                   // Print and reduce a
      :a                                 // Retry random selection
      ,0);                               // Second arg, recurse
}
f(a,b){
    b>a&&                                // Loop recursively on b>a
    f(a,b-1);                            // Reduce b, recurse
    b%8?printf("%d",b)                   // Print non 8's
       :s(b,0);                          // Call s() for 8's
    printf(" ");                         // Space separator
}

You can save 3 bytes if you change to a newline separator (puts instead of printf).

It's more fun to play with your solution :-)

115 bytes

APL (Dyalog Extended), 32 bytes
{(?84¨⍕⍵)⊇⎕D~⍨'!'…'~'}¨@{0=8|⍵}…

Try it online!
Huge thanks to Adám and dzaima for their help. First time using Dyalog Extended!
Explanation:
{(?84¨⍕⍵)⊇⎕D~⍨'!'…'~'}¨@{0=8|⍵}…  ⍝ Dyadic 2-train

                               …  ⍝ Tacit range: list of numbers from left arg
                                  ⍝ to right arg inclusive
{(?84¨⍕⍵)⊇⎕D~⍨'!'…'~'}¨@{0=8|⍵}   ⍝ Monadic function applied to above
                        {     }   ⍝ Function definition
                           8|⍵    ⍝ 8 modulo every item in our range
                         0=       ⍝ Transform list into a boolean vector, with
                                  ⍝ 1 where item was equal to zero, 0 otherwise
                      ¨@          ⍝ Applies left function to each item selected
                                  ⍝ by above
{                    }            ⍝ Function definition
              '!'…'~'             ⍝ Range of all printable ASCII chars
          ⎕D~⍨                    ⍝ Remove numeric characters from above
 (    ⍕⍵)                         ⍝ Convert function argument to string
                                  ⍝ (e.g., 123 -> "123")
   84¨                            ⍝ For each character, replace with number 84
                                  ⍝ (number of non-numeric printable ASCII chars)
  ?                               ⍝ Generate random number from 1-84 for each
                                  ⍝ 84 in list
         ⊇                        ⍝ Index the ASCII char list with above random
                                  ⍝ numbers

postgresql9.6 251 chars
very long code but postgresql also does it.
do language plpgsql $$ begin for n in a..bloop raise info'%',case when 0=n%8then(select array_to_string(array(select*from(select chr(generate_series(33,126)))t where chr!~'\d'order by random()limit floor(log(n))+1),''))else n::text end;end loop;end;$$

formatted sql is here:
do language plpgsql $$
begin
for n in a..b loop
    raise info '%',
    case when 0 = n % 8 then (
        select array_to_string(array(select * from (
            select chr(generate_series(33, 126))
        ) t where chr !~ '\d' order by random() limit floor(log(n)) + 1), '')
    ) else n::text
    end;
end loop;
end;
$$

PHP, 163 bytes
$n=range(48,57);$c=array_diff(range(32,126),$n);
foreach(range($a,$b) as $v){if($v%8!=0){echo $v;}
else{for($i=0;$i<strlen($v);$i++){echo chr($c[array_rand($c)]);}}}

Explanation:

$n = range(48,57) These are the ASCII codes for numbers, which are in the middle of special characters (32-47) and other characters (58-126).
$c = array_diff(range(32,126), $n) Using the $n array, exclude numeric characters and build an array of acceptable ASCII characters.
foreach(range($a,$b) as $v) Loop over the range of values from $a to $b (inclusive), as $v inside the loop.
if($v % 8 != 0) { echo $v; } Test for $v being evenly divisible by 8 using the mod operator %.
else { for($i = 0; $i < strlen($v); $i++) { ... }} If not evenly divisible by 8, loop enough times for the number of digits in the number and print the characters (in the next step).
echo chr($c[array_rand($c)]) Print a single character from the acceptable array of ASCII values in $c. array_rand returns an index in the array, so we have to get the actual value at that index using $c[random_key].

I could probably make this smaller by creating $c differently, and the loop to print the ASCII characters feels clunky so I'll continue to ponder how to shorten that.

Thanks Jake! Glad to hear from you! Take a look at my new challenge Random Pixel Poking if you have time too!

QBIC, 79 bytes
::[a,b|~c%8=0|[_l!c$||_R33,116|~e>47 and e<58|e=e+z]Z=Z+chr$(e)]\Z=Z+!c$]Z=Z+@

Skipping the numbers is a costly affair, here's a version that might also randomly select 0-9 for 20 bytes less:
::[a,b|~c%8=0|[len(!c$)|Z=Z+chr$(_r33,126|)]\Z=Z+!c$]Z=Z+@

Sample output for 1, 89
1 2 3 4 5 6 7 U 9 10 11 12 13 14 15 M9 17 18 19 20 21 22 23 ^L 25 26 27 28 29 30
31 <U 33 34 35 36 37 38 39 gH 41 42 43 44 45 46 47 aJ 49 50 51 52 53 54 55 1b 57 58 59 60
61 62 63 ,C 65 66 67 68 69 70 71 ]; 73 74 75 76 77 78 79 [B 81 82 83 84 85 86 87 Ix 89

Explanation:
::        Get inputs 'a' and 'b' from the command line
[a,b|     FOR(c=a; c<=b; c++)
~c%8=0|   IF c is cleanly divisible by 8 THEN
 _l!c$|   Take the length (_l) of the string representation (! ... $) of c
[      |  FOR (d = 1; d<= length(c); d++)
_R33,116| Set e to a random value in the range 33 - 116 (all the printable ascii's - 10)
~e>47     IF e falls between 47
and e<58| and 58 (ASCII code for 0-9) THEN
e=e+z     e = e + 10 (z == 10 in QBIC)
]         END IF
Z=Z+      Add to Z$
chr$(e)]  ASCII character e
\         ELSE if c is not cleanly divisible by 8
Z=Z+!c$   Add to Z the string representation of c
]         NEXT
Z=Z+@     Add a space to Z$ (@ is an implicitly delimited string literal with 1 significant space)

( Z$ is implicitly printed at end of program )

PHP, 130 bytes
function($a,$b){for(;$a<=$b;$a++)echo$a%8?$a:(function($l){while($l--)echo chr(($x=rand(44,128))-($x>58?:11));})(strlen($a))," ";}

Try it online!
Ungolfed:
function c8( $a, $b ) {
    for( ; $a<=$b; $a++ ) {                // loop between a -> b
        echo $a % 8 ? $a :                 // every 8, call anon func instead of value
            (function($l) {
                while( $l-- ) {            // repeat length of value
                    $x = rand( 44, 128 );  // range size is printable chars [33,47][58,127]
                    $x-= $x > 58 ?: 11;    // Subtract one from x. If x was less than or
                                           // equal to 58, subtract a further ten from it
                                           // so that it now falls within the 33-47 range
                    echo chr( $x );        // echo ASCII value
                }
            })( strlen( $a ) )," ";
    }
}

Yes, my mistake. Regarding $x-= $x > 58 ?: 11;    // subtract 11, if x is less than 58 -- could you elaborate?

@JonathanFrech in other words we want a number that's between 33-47 or 58-127.  So we pick a number that's 58 minus the size of the lower range.  If the number is below 58 it's just translated down to the lower range by subtracting the difference. Because of course we can't display numbers (ASCII  char 48-57)

The ternary is just a shortcut to doing it. Basically $x > 58 evaluates to 1, and so we either subtract that or 11 from $x.  In the case where it's higher, it's offset by the ASCII values in the rand() statement being one higher. You can see that this generates a uniformly random (as uniform as PHP's rand() is capable of) distribution: https://tio.run/##K8go@G9jXwAkVRIVbBUSi4oSKzU0rbm40vKLNFQqbQ2sFVQqFWwUDA2AAMTW1lbQ5OJUSYyOBSrXUKmwLUrMS9EwMdExNLLQ1NQFitiZWthbGRqCDCnOLyrRUACaDOIUFGXmlcQXaUAsiU/OLwVyyxJzSlOLIWqAqv7/BwA

I think I know roughly what the Elvis operator does, I just think your comment is misleading.

I would think it works like Subtract one from x. If x was less than or equal to 58, subtract a further ten from it., no?

@JonathanFrech, that's it.  I'll update the comment to make it more clear. Thanks for your suggestions!

05AB1E, 17 bytes
ŸεD8ÖižQžhK¦.rsg£

Takes the input as highest\nlowest, and outputs a list.
Try it online or verify all test cases.
Explanation:
Ÿ                  # Create a list in the range [low (implicit) input, high (implicit) input]
 ε                 # Map each value to:
  D                #  Duplicate the value
   8Öi             #  If it's divisible by 8:
      žQ           #   Push all printable ASCII characters (" " through "~")
        žhK        #   Remove all digits
           ¦       #   Remove the first character (the space)
            .r     #   Randomly shuffle the remaining characters
              s    #   Swap to take the map value again
               g   #   Get its length
                £  #   And leave that many characters from the string
                   # (and implicitly output the resulting list after we're done mapping)

Japt, 20 bytes
;òV ®%8?Z:EÅk9ò)öZìl

Try it
;òV ®%8?Z:EÅk9ò)öZìl     :Implicit input of integers U & V
 òV                      :Range [U,V]
    ®                    :Map each Z
     %8                  :  Modulo 8
       ?Z:               :  If truthy, return Z, else
;         E              :  Printable ASCII
           Å             :  Slice off first character
            k            :  Remove
             9ò          :    Range [0,9]
               )         :  End remove
                 Zì      :  Digit array of Z
                   l     :  Length
               ö         :  Get that many random characters from the string

Forth (gforth), 128 bytes
include random.fs
: f 1+ swap do i 8 mod if i . else i 0 <# #s #> 0 do 83 random 33 + dup 47 > 10 * - emit loop ."  "then loop ;

Try it online!
Explanation
Loop from start to end, print number if not multiple of 8, otherwise get the number of digits in the number and print that many random characters followed by a space
Code Explanation
include random.fs          \ include/import the random module
: f                        \ start new word definition
  1+ swap                  \ add 1 to end number, because forth loops are [start, end), and swap order
  do                       \ start counted loop form start to end
    i 8 mod                \ get the remainder of dividing i (loop index) by 8
    if                     \ if true (not 0, therefore not multiple of 8)
      i .                  \ print the index
    else                   \ otherwise
      i 0                  \ convert index to double-length number
      <# #s #>             \ use formatted numeric output to convert number to a string
      0 do                 \ loop from 0 to (string-length - 1)
        84 random          \ get random number between 0 and 83
        33 +               \ add 33
        dup 47 >           \ check if result is larger than 47
        10 * -             \ if it is add 10 to result (results in number in range: 33-47,58-126)
        emit               \ output ascii char corresponding with number
      loop                 \ end inner loop
    ."  "then            \ output a space and then close the if/else
  loop                   \ end the outer loop
;                        \ end the word definition

UnGolfed
I don't usually ungolf my solutions, but this one is long/complicated enough that I think it's needed
include random.fs

\ get the length (in digits) of a number
: num-length 0 <# #s #> nip ;

\ check if a number is a multiple of another
: is-multiple mod 0= ;

\ get a random printable non-digit ascii char
: random-char 84 random 33 + dup 47 > 10 * - ;

\ get a "random" string of printable ascii chars the same length as a number
: rand-str num-length 0 do random-char emit loop space ;

\ print numbers from a to b, replacing multiple of 8 with a random ascii string of the same length
: crazy-eights 1+ swap do i 8 is-multiple if i rand-str else i . then loop ;

Kotlin, 136 bytes
{r:IntRange->var s=""
for(i in r){for(c in "$i"){var n=java.util.Random().nextInt(83)
if(n>14)n+=10
s+=if(i%8>0)c
else '!'+n}
s+=" "}
s}

Try it online!

Zsh, 67 bytes
for i ({$1..$2})((i%8))||i=`tr -dc !-/:-~</*/ur*|head -c$#i`&&<<<$i

Try it online!
Feels pretty long, but so are most answers to this one.

Python 2, 180 Bytes
from random import*
def f(a,b):
 for i in range(a,b+1):
  if i%8<1:
   k,i=str(i),''
   for _ in k:i+=choice([chr(j)for j in range(33,48)]+[chr(j)for j in range(57,126)])
  print i

EDIT:
Thanks @Flp.Tkc for realising I hadn't read the task properly.
Thanks @Caleb for pointing out I could use a few to reduce the byte count.
Thanks @Dennis for pointing out about the fact that numbers can't be included.
EDIT 2:
The current version could probably be simplified more than it is.

PowerShell, 82 89 bytes
$a,$b=$args;$a..$b|%{($_,(-join[char[]](33..47+58..127|random -c "$_".Length)))[!($_%8)]}

Try it online!

58..127 does not include the printable ASCII symbols in the lower range 33 (!) to 47 (/).

@zeppelin true, I didn't think that was a requirement, but re-reading it, I suppose it must be if it's to be a uniform distribution. Updated!

Ruby, 80 bytes
->a,b{$><<(a..b).map{_1%8<1?_1.to_s.gsub(/./){[*?!..?/,*?:..?~].sample}:_1}*" "}

Attempt This Online!

source: Stack Exchange

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

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

sort: votes


text:
I'm too cold, turn up the temperature
This is my first golf contest.
What you need to do
Build me, in the shortest amount of bytes possible, my AC remote control system. My room is too cold right now, and I'm missing my remote.
Now, I don't want you literally building it or anything, just golf this:
A slow increment of temperature, starting at 40 degrees, and ending at exactly 72. The increment time must always be 500 millis per increment. It can wait another 500ms at the end. I would prefer it to stop however. The increment itself must go up by two each time, like my remote.
You should not clear the screen. You should have newlines.
What should happen
Example output (everything in parentheses shouldn't be outputted).
40
(wait 500 millis)
42
(wait 500 millis)
44
(..repeat until 72..)
72
(stop or wait 500ms)

Keep in mind
This is my first golf, so I apologize if this is too hard to golf. :(
Best of luck, golfers!

Minor thing, but "must always be 500 millis" is fundamentally too strict for any reasonable device. I'd recommend specifying a variance, something like +/-10%.

Can you wait 500ms before showing initial output?

-1 for using Fahrenheit (not really, but you should at least say you're using it; 40 degrees celsius isn't too cold in the slightest)

+1 for using Fahrenheit, it has better resolution than Celsius and is just as arbitrary as anything not Kelvin or Rankine

May we wait half a second before printing 40?

Changing the challenge spec after answers have already been posted is much frowned upon, for obvious reasons. At the very least you should have notified the authors of those answers about the change (newlines compulsory, as opposed to clearing the screen)

@NickT then you're out of luck because this remote's resolution is 2°F which is higher than 1°C. And you can get higher resolution in Celcius than Fahrenheit with a remote that can display 0.5 and much more if it can display to 0.1. Anyway I'm a simple man and can't differentiate between 22 and 23°C so high resolution in this case is useless to me

@NickT Not Reaumur either

@SIGSEGV or degrees Baume

Minecraft 1.9.0+, 204 162 bytes +  58 36 28 24 20  blocks = 262 240 232 186 182 blytes
This solution is golfed down, and it can't be seen whole in one, or even two screenshots. Uses two glitches and abuses another two features of the game

This solution uses the same principles as the one below, just a 4 blocks more compact design.

Abuses the fact that Chain command blocks (green blocks) can't be powered by redstone, only by a singal from a impulse command block (orange).

Abuses the fact pistons take 0.30 seconds to extend completely, and redstone needs only 0.10s to register a signal.

Also abuses a twofold glitch to set the timer (TNT) off: the redstone next to the timer (TNT) gets not only powered, but also thinks the TNT is another redstone and powers it.

On top of all these abuses, the signal shortener (thing under the TNT) is one-use, after it gets powered it changes shape, allowing to pass signal through it to the "incrementer" (topmost orange block)

A bit of explanation on the functionality of it's different parts can be seen in older solutions (but best in the one just below). You can also Try it Offline! (simplified solution incrementing by 4, works only in 1.11+) by running this command in a command block.

Old solution, Minecraft 1.9.0+, 186 blytes:

Since TNT normally explode after 3.0s in Minecraft, this one has to be placed by a command (/setblock) with a specified fuse. Also uses a more compact design to remove redundant command block (containing 42 bytes) and redstone against the older versions. I'm sure this can't get any lower...
Older solution, Minecraft 1.9.0+, 232 blytes:
Oops, I found out these older solutions increment by 4...

Uses the 1.9 command block chain feature (green block thing) to save blocks. Also uses a more compact signal shortener then in the older solutions
Even older solution, Minecraft 1.7.0+, 240 blytes:

Uses a more compact timer (TNT) then the first solution (below).
Oldest solution, Minecraft 1.7.0+, 262 blytes:

This is so long because of the way Minecraft handles variables:

To define a variable (int): scoreboard objectives add <variable> dummy

To set a value to a variable (each entity including players has it's own variable value): scoreboard players set <entity> <variable> <value>

* can be used as <entity> to select all entities and save bytes.

only defined variables may be used

the value of the variable must be set to a number, not a variable

To increment var1 by var2: scoreboard players operation <entity> var1 += <entity> var2

<entity> must be a single entity, eg. @p, not *

Screenshots are of my own, dual licenced under WTFPL and what licence SE decides to use today (currently  cc by-sa 3.0 with attribution required) :-)

@IMustBeSomeone Wait, I found a way to golf this :)

...your circuit blows itself up when done.

@SuperJedi224 Yes. Is it wrong?

@RudolfL.Jelínek I'm pretty sure it's not actually against the rules, but it is kind of weird. Then again, that's part of what code golf is about.

@SuperJedi224 Yeah, code golf and Minecraft shouldn't be put together :) . Thanks for noticing, though.

Golf... whole in one... hahahah nice

Blytes? Is that intended?

@ghosts_in_the_code yep, bytes + blocks :]

Bash + linux utilities, 19
seq 40 2 72|pv -qlL2

seq generates the numerical output.  pv ratelimits it to 2 lines/sec.

The output -q suppresses goes to STDERR, so I don't think you need it.

An excellent demonstration of "do one thing and do it well" with the right tools for the job. :)

Coming close to "anti-golfscript anti-golf" territory.

Vim, 24, 23 bytes/keystrokes
i40<esc>qq:sl500m
Yp2<C-a>q15@q

One byte saved thanks to @Kritixi Lithos!
Written from my phone, tested in mobile vim (which is apparently a real thing).
Here's a gif of it running:

And here is a command-by-command explanation:
i40<esc>            " Insert '40' into the buffer
        qq          " Start recording into register 'q'
          :sl500m   " Sleep form 500 ms
Y                   " Yank this line
 p                  " and paste it on a newline
  2<C-a>            " Increment this line twice
        q           " Stop recording
         15@q       " Callback register 'q' 15 times

The s in ms is optional, you can remove it to save a byte :)

@KritixiLithos I knew that! How did I overlook that? Thanks!

The student has become the teacher :P

"I'll post a gif and an explanation later once I have access to a computer" waits half a year (not quite)

@HyperNeutrino Hahahahaha, I completely forgot about this answer. Is that better :P

There we go. Thanks. :) There was an answer once, I can't remember where, that said "will post explanation later", and 6 years later it still hasn't been edited...

JavaScript (ES6), 52 bytes

f=(i=40)=>console.log(i)|i-72&&setTimeout(f,500,i+2)

f()

Here's a more neat re-arrangement of your answer for you: f=(i=40)=>setTimeout(i>70||f,500,i+2,console.log(i)). Sadly, still the same 52 bytes.

Shouldn't this be 50 bytes as you don't need to count the f= based on the meta consensus that anonymous function declarations are allowed?

@R.Kap Good catch, but in this case, the f= is required because the function needs to call itself (as the first parameter to setTimeout).

Jelly, 13 12 bytes
40µṄœS.+2µ⁴¡

Try it online! The Jelly program is wrapped in a Bash script to prefix each line of output by a timestamp.
How it works
40µṄœS.+2µ⁴¡  Main link. No arguments.

40             Set the return value to 40.
  µ      µ⁴¡  Execute the chain between the two µ 16 times.

   Ṅ           Print the return value, followed by a linefeed.
      .        Yield 0.5.
    œS         Sleep for 0.5 seconds. Yield the previous result.
       +2      Add 2.

After the last iteration, the final value of 72 is printed implicitly and the program exits.

Wow, is that an intended feature, being able to call other languages from Bash in tio?

Yes, that's intended. You should be able to do the same from all languages that support system calls or similar features.

For a language that wins golfing challenges and the part of the challenge being incrementing by a constant value, this looks very long to me :)

Perl 6, 30 bytes
for 20..36 {sleep .5;say 2*$_}

Sorry that it looks like un-golfed code, I don't see a way to make it shorter...
The version that stops right after the last number, would be 37 bytes:
for 20..36 {sleep .5 if $++;say 2*$_}

Do you need the space after 36?

.say&sleep(.5) for 40,42...72 29 bytes

@ugexe: Relying on the side-effects of the arguments of non-shortcircuiting operators to happen in order, feels like an implementation-specific hack to me, because AFAIK the language spec doesn't guarantee this. OTOH, maybe for code golf that's okay?

@SeeOneRhino: Yes. A { bracket following another expression without whitespace, is interpreted as the start of a hash ("associative array") subscript. Perl 6 is strict like that, because its grammar was deliberately designed to allow one-pass parsing of source code with (almost) no backtracking.

Pyth - 12 bytes
Very simple, uses a for loop from 0-17.
V17+40yN.d.5

MATL, 14 bytes
17:E38+".5Y.@D

Try it in MATL Online! You may need to reload the page if it doesn't initially work.
Explanation
17:     % Push array [1 2 ... 17]
E       % Multiply by 2, element-wise
38+     % Add 38, element-wise. This gives [40 42 ... 72]
"       % For each k in that array
  .5Y.  %   Pause 0.5 seconds
  @D    %   Push k and display
        % End (implicit)

Old version (before spec change), clearing the screen
17:E38+"5&Xx@D

Try it in MATL Online!

You don't need to clear the screen.

@Adám Thanks. I know, but it took the same number of bytes and it looks nicer :-)

@LuisMendo The golf challenge states something about not clearing the screen, after edits/clarifying (possibly after your post)

@ThomasWard Thanks for the heads-up! The OP really should have notified answerers about the change

TI-Basic (CE or CSE only), 16 bytes
:For(A,40,72
:Pause A,.5
:End

Note that many commands are single byte tokens.

I see 29 bytes? Is it possible for you to show the 8 byte code?

TI-Basic has its own character set. For(, Pause , End, and the colons at the beginning of lines are all single bytes.

Strange ... alright, it seems like other answers do that too.

Relevant: http://meta.codegolf.stackexchange.com/questions/1541/how-to-score-ti-basic

C compiled with Clang 3.8.1 on Linux, 62 59 58 bytes
2 bytes saved thanks to @ranisalt
s=38;main(){for(;s<74;printf("%d\n",s+=2))usleep(500000);}

59 bytes
s=38;main(){for(;s<73;printf("%d\n",s+=2+usleep(500000)));}

62 Bytes
s=38;main(){for(;s!=72;){printf("%d\n",s+=2);usleep(500000);}}

s=38                # Initializes a global (int) variable, this is only possible in C, in other languages from the C family variables must have an explicit type.
main()              # Is the main entry point, again as before, in case a type isn't specified C defaults to int
printf("%d\n",s+=2) # printf outputs to stdout based on the pattern defined in the first parameter
                    # %d is a placeholder for an int variable
                    # \n appends a newline to stdout
                    # The second parameter increments the s variable and afterwards it goes in the placeholder's spot.
usleep(500000)      # This function is Linux specific, it takes an int as parameter, it represents how much time the app needs to sleep in microseconds

Thanks for the answer, and welcome to the site. Could you add a bit of explanation for those who aren't as familiar with your language?

Thanks for welcoming me. Yeah sure, I can do that. Also, how do I make my post calculate how many bytes it takes? I wrote that myself, but in others' posts it looks different.

Everyone writes it themself, there's no auto-calculating feature. Your header uses ** ... ** in markup, whereas the traditional header on this site uses # .... I've edited your answer so you can see how it's done.

@isaacg Thanks a lot. It does look better now.

Using s<72 saves another byte.

@ranisalt Oh yeah, how could I've missed it. Thanks

@ranisalt Though I need s<73 because it also needs to print 72

@WadeTyler not really, in the last iteration s is 70 and prints 72 because of +=2. If you use 73, it prints up to 74 since in the last iteration s is 72

You can spare extra 2 bytes using , (comma operator) between printf and usleep and omitting the braces on for. Or one more if you move usleep inside for as iteration step.

@ranisalt For some reason it prints up till 70 if I use s<72.

Let us continue this discussion in chat.

Dyalog APL, 20 bytes
{⎕DL.5⊣⎕←⍵}¨38+2×⍳17

{ the anonymous function
 ⎕DL delay...
 .5⊣ half (a second) rather than the value of
 ⎕← print (with newline)
 ⍵ the argument
}¨ applied to each of
38+ thirty eight plus
2× twice
⍳17 the integers from 1 to 17

Mathematica, 34 bytes
Pause[Print@#;.5]&/@Range[40,72,2]

Full program. Takes no input and outputs to STDOUT.

Perl 6, 27 bytes
sleep .say/2 for 40,42...72

say returns True, which is coerced to a numeric 1 when divided by 2.
Unicode shenanigans can get it down to 23 characters:
sleep .say/2 for ㊵,㊷…72

But that's 29 UTF-8-encoded bytes.

Python 2, 57 56 55 Bytes
import time
a=40
while a<73:print a;time.sleep(.5);a+=2

EDIT:
-1 Byte thanks to Mega Man
-1 Byte thanks to Flp.Tkc

You could save one byte by using .5 instead of 0.5

@MegaMan Thanks, I hadn't realised that could work

Why not take off the parenthesis around the print statement and use Python 2?

R, 49 bytes
x=38;while(x<72){Sys.sleep(.5);x=x+2;cat(x,"\n")}

Very trivial solution but it does the trick.

Initial x=40 does not print 40 at start. You have to start with x=38.

Funny, same idea but with a for-loop is exactly the same length.

QBIC, 21 bytes
[44,72,4|?a┘'sleep 1.

QBIC starts a FOR-loop, running from 44 to 72 and incrementing the counter by 4 on every loop. It then sleeps for 1 second. QBasic doesn't have a more finegrained control foor sleep, so I've added a . to simulate giving .5 as an argument.

C#, 95 bytes
()=>{for(int i=40;i<73;i+=2){System.Console.WriteLine(i);System.Threading.Thread.Sleep(500);}};

It is a simple for loop, it waits an extra 500ms at the end.

Ruby 31 bytes
20.upto(36){|n|p n*2
sleep 0.5}

Try it online!

Ruby, 33 bytes
(40).step(72,2){|n|p n;sleep 0.5}

Kotlin, 47 bytes
I guess it was not said in the problem statement that solutions should actually contain increment by two, so the 40+2*i is legal here.
If written as a regular Kotlin source with main:
fun main(args:Array<String>){(0..16).map{println(40+2*it);Thread.sleep(500)}}

(77 bytes)
UPD: In Kotlin 1.3, args:Array<String> can be removed, so it's 18 bytes less.
And in Kotlin Script, the whole program would be
(0..16).map{println(40+2*it);Thread.sleep(500)}

(47 bytes)

Your first program seems to first wait a long time, then output all the results.

@devRicher, seems like you are running it at try.kotlinlang.org. If so, that's a problem of the environment, seems like stdout is not flushed or something. When I run it locally, it behaves as intended.

Haskell, 67 bytes
import System.Posix.Unistd
mapM((>>usleep 500000).print)[40,42..70]

If you want to go with ghc only, you can save a few bytes by importing GHC.Conc and using threadDelay instead of usleep.

Common Lisp, 57 52
(loop for b from 40 while(<(print b)72)do(sleep .5))

Print returns its input parameter.
The program exits immediately after reaching 72.

Ungolfed:
(loop
  for b from 40
  do (print b)
  while ($t+=2;usleep(5e5))echo$t+38,_;

uses underscore as delimiter. Run with -nr.

Racket 46 bytes
(for((i(range 40 73 2)))(println i)(sleep .5))

Ungolfed:
(define (f)
  (for ((i (range 40 73 2)))
    (println i)
    (sleep .5)))

Command to run: (f)

Clojure, 54 bytes
(doseq[t(range 32 73 2)](println t)(Thread/sleep 500))

Third lisp ftw. Just iterates over the range, printing and sleeping each iteration. Sleeps at the end.
Ungolfed:
(doseq [t (range 32 73 2)]
    (println t)
    (Thread/sleep 500)))

A version that doesn't sleep at the end, 66 bytes
(doseq[t(range 32 73 2)](println t)(if(< t 72)(Thread/sleep 500)))

Note, these are full programs since the instructions don't specify. Add a byte to each if a function is required.

Octave, 38 35 bytes
Saved 3 bytes thanks to @LuisMendo by changing endfor to end
for i=20:36;disp(2*i);sleep(.5);end

Try it online!
I am new to Octave, so this solution still might be golfed further. Any tips are welcome!
Ungolfed
for i=20:36
  disp(2*i)
  sleep(.5)
end

R, 44 42 bytes
Straightforward for-loop, there's likely a golfier way. (Also, crossed-out 44 is still regular 44...)
for(i in 20:36*2)cat(i,"\n",Sys.sleep(.5))

Browser Javascript, 52 51 chars
eval(s="s=alert(x=setTimeout(s,500)*2+38)|x<69&&s")

Test with console.log instead of alert:

eval(s="s=console.log(x=setTimeout(s,500)*2+38)|x<69&&s")

Always room to improve I see :—) Nice!

Python 2, 57 58 Bytes
Edit
Counted as 57 bytes on my handy but TIO says 58 now that I'm back on my own machine so that's my final offer. Interestingly enough TIO doesn't seem to respect the timeout and just waits and then prints out the whole list in one go. Works on QPython for Android and Python 2 on my Ubuntu box so that's good enough for me.
import time
for x in range(40,74,2):print x;time.sleep(.5)

Try it online!
Would be 58 59 in Python 3 so doesn't beat @sonrad10 anyway.

This would throw a syntax error, you need a colon (not semicolon) after the range(...)

Thanks @Flp.Tkc. It was typed in directly on my handy hense the typo.

F#, 60 bytes
async{for i in 40..2..72 do printfn"%d"i;do!Async.Sleep 500}
This is an async expression, in order to run it pass it into Async.Start or Async.RunSynchronously.

Noodel, noncompeting 10 bytes
Cannot compete because Noodel was born after the challenge was created:(
40Ḷ16ñ++ḍh

Try it:)
How it works
40         # Creates the literal number 40 and places it into the pipe.
  Ḷ16      # Loop the following code 16 times.
     ñ     # Print what is in the front of the pipe with a new line.
      ++   # Increment what is in the pipe by two.
        ḍh # Delay for a half a second (500ms).

There is not a version of Noodel that supports the syntax used in this answer. Here is a version that is correct:
kȥḶ16ñ⁺2ḍh

Windows Batch - 65 62 61  bytes
btw this is my first PPCG answer
@for /l %%p in (40,2,72)do @echo %%p&@ping 1.1 -n 1 -w 10>nul

This exits when the degree reaches 72.

76 75 bytes - Does not sleep at end
@for /l %%p in (40,2,72)do @echo %%p&if %%p lss 72 @ping 1.1 -n 1 -w 10>nul

Ungolfed and explanation:
@echo off                           - Turns of the prompt(C:\Foo\Bar\Baz>)
for /l %%p in (40,2,72) do (        - For loop that loops from 40 to 72, increase 2 each
    echo %%p                        - Outputs the loop counter(which is the temp.)

if %%p lss 72 (                     - If loop counter is less than 72,
        ping -n 1 -w 10 1.1 >nul    - ping an non-existing IP to make delay

                                    - note: ping will always make 500ms delay
                                    - if waiting time is less than 500ms
    )                               - Closing bracket(if statement)

)                                   - Closing bracket(for statement)

Excel VBA (32-Bit Only), 123 Bytes
Declares the windows Kernel32 Sleep(ByVal dwMilliseconds as Long) function and uses a recursive helper function. Outputs to the VBE immediate window.
Declare Sub Sleep Lib"kernel32"(ByVal t&)
Sub a(i)
Debug.?i
If i<72Then Sleep 500:DoEvents:a i+2
End Sub
Sub b:a 40:End Sub

Usage and Ouput
as seen from an b subroutine call from the VBE immediate window
b        ''  <- Subroutine Call
 40      ''  <- Output
 42
 44
 46
 48
 50
 52
 54
 56
 58
 60
 62
 64
 66
 68
 70
 72

PowerShell, 32 31 bytes
40..72|%{$_[$_%2];sleep -m 250}

Try it online!
Sleeps regardless if it's odd or even for half the time but will only output when the value is even due to out-of-bounds indexing returning nothing. Lost several bytes due to sleep defaulting to seconds and only taking ints.

*><>, 20 bytes
"H&"v
?;5S>2+:n:{:}=

Try it here!
This outputs the 40 and adds two every 500ms, outputting the new number. At 72 the program does not wait and exits immediately. Wasn't sure if we needed any sort of deliminator in-between the temperatures so there isn't one included.
Explanation
Setup:

"J("   push 72 and 38 (temp) to the stack
    v  enter main loop at ">"

Main loop:

>               move the IP right
 2+             add two to temp
   :n           copy and output temp
     :{:}       copy temp and 72
         =?;    if temp == 72, exit
            5S  sleep 500ms

postgresql9.6, 162 bytes
do language plpgsql $$ declare n smallint;begin foreach n in array array(select generate_series(40,72,2))loop raise info'%',n;perform pg_sleep(.5);end loop;end;$$

formatted sql is here:
do language plpgsql $$
declare n smallint;
begin
foreach n in array array(select generate_series(40, 72, 2)) loop
    raise info '%', n;
    perform pg_sleep(.5);
end loop;
end;
$$

Factor, 36 bytes
20 36 [a,b] [ 2 * . 5e8 sleep ] each

Pretty simple.

Python 3, 61 bytes
Not a winner, but a horrible, horrible abuse of a list comprehension: two side-effects and the result isn't even used.
import time
[print(2*x+40)==time.sleep(.5)for x in range(17)]

Similar:
[time.sleep(.5)for x in map(print,range(40,74,2))]

I like this. It's clever. Reminds me of a time when I had to print and return something inside of a lambda so I did lambda: (print(...), ...)[1]

Python 2, 54 bytes
Thanks @xnor for cutting 2 bytes off!
import time;x=40
exec'print x;x+=2;time.sleep(.5);'*17

55 bytes
This one uses a dfferent counting approach, can probably still be golfed:
import time;x=34
while x:print 74-x;x-=2;time.sleep(.5)

Can't your exec loop do x+=2?

@xnor yep, brain derp... thanks

GNU sed, 87 + 1 = 88 bytes
+1 byte for -u flag (prevents sed from waiting until the end to flush all of the output).
Assumes it's running in an environment where the shell command sleep .5 works.
s/.*/40/
:
p
esleep .5
/72/Q
/8/bz
h
y/0246/2468/
s/.//
H
x
s/.\n//
b
:z
y/4568/5670/
b

Try it online! (Using Dennis' handy bash wrapper to timestamp each output line.)

RBX.Lua, 36 bytes
Uses UTF-8 encoding. Golfed:
for i=40,72,2 do wait(.5)print(i)end

Should be pretty obvious to people with Lua knowledge. Here's an explanation:
for i=40,72,2 do --For-loop, counting from 40 to 72 in steps of 2.
wait(.5) --RBX.Lua builtin. Waits 0.5 seconds.
print(i) --Prints current temperature.
end --End of for loop.

Java, 93 bytes
a->{for(a=38;(a+=2)<73;){System.out.println(a);try{Thread.sleep(500);}catch(Exception e){}}};

This is a java.util.function.Consumer<Integer> that makes me want to take a new NullPointerException() and use it to slap whoever who made Thread.sleep() throw a checked exception.
Identical-in-length snippet that does the exact same thing with an "everyday" method:
void a(int A)throws Exception{for(A=38;(A+=2)<73;){System.out.println(a);Thread.sleep(500);}}

How long would this be as a full program?

ForceLang, 71 bytes
For some unknown reason, does not quite work if you run the interpreter using Eclipse, but still functions properly if you run the interpreter using your terminal directly. ¯\_(ツ)_/¯
set s 38
label 1
io.writeln set s s+2
datetime.wait 500
if -72+s
goto 1

SAS, 60 bytes
Something different :)
data _null_;do i=40 to 72; put i;s=sleep(.5,1);end;run;

Common Lisp, 54 bytes (45 if trailing newline is allowed)
(dotimes(i 17)(format t"~a~&"(+(* 2 i)40))(sleep 0.5))

shorter - with trailing newline, because print adds one:
(dotimes(i 17)(print(+(* 2 i)40))(sleep 0.5))

101, 98 78 bytes
00001 101000 001 11 00001 01001000 00001 0001 000010 1111 00001 1001 000101 111

EDIT: The language has beed updated to support equals etc. So i managed to narrow it down a little. Note: i did not update the explaination.
developed a programming language in python over the course of the 2 last days. Its fairly simple, but is a pain to program in, as it consists only of 1's and 0's, and can only hold binary numbers with up to 6 numbers.
Explenation:
00001 101000 # declares variable 00001 to 40
00010 100010 # declares variable 00010 to 34

001 00010 # start of loop, checks if variable 00010 is over 0
00010 0011 000010 # 0011 is the function for decrementing, and i decrement by 2 (decimal)
1111 00001 # 1111 is the function for printing
00001 0001 000010 # same as above, only addition
1001 000101 # 1001 is timer, takes a whole number and divide by 10 to allow milliseconds
111 # same as end symbol in ruby

EDIT: Link to the language https://github.com/hrrs01/101
Easily tested by running the demo file by doing (if python in PATH):

101.py demo.txt

Swift, 208 bytes
import Foundation
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
func n(){if t<72{DispatchQueue.main.asyncAfter(deadline:.now()+0.5){t+=2;print(t);n()}}}
var t=40;print(t);n()

sleep() takes a UInt32 in Swift, so won't work for the 500 millisecond delay. If it was 1 second however:
import Foundation;(20...36).map{$0*2}.forEach{print($0);sleep(1)}

…65 bytes (with a delay at the end)

Python 2, 57 bytes
import time as t
x=40
while x<73:print x;t.sleep(.5);x+=2

This does require an 'extra' newline to actually run, so arguably response is 58 bytes (please feel free to edit/comment if this is what the figure above should be).
Edit: Remove unecessary whitespace between : and print
Edit2: changed 0.5 to .5, saving one byte.
Edit3: failed to add/count the sleep import, which raises the score to 60 bytes.
Edit4: Saved 3 bytes by adding extra line

RbxLua, 36 bytes
for i=40,72,2 do print(i)Wait(.5)end

Thought I'd use RbxLua, which is a modified version of Lua 5.1 used on ROBLOX.com, as it has a built-in Wait(s) function that is one byte shorter than sleep(ms) in Lua 5.3.
Edit: Didn't see the other RbxLua solution. This solution uses a non-deprecated form of wait.

dc, 50 bytes
0sm[40lm+p0se[le1+dse120000>j]dsjxlm2+dsm33>p]dspx

Well, this seems to be the first answer which does not utilize any sleep built-in as dc seemingly does not have one. Instead, this simply utilizes a macro loop which during each of 16 iterations increments 40 by 2*iteration #, outputs the sum on a new-line, and utilizes another macro loop which is iterated through 120000 times giving us our desired 500 millisecond sleep with a very slight and unnoticeable variance.

05AB1E, 11 bytes
40žvƒ=Ì₄;.W

Try it online.
Explanation:
40           # Push 40
  žvƒ        # Loop 17 times (in the range [0,16]):
     =       #  Print the top of the stack with newline (without popping)
      Ì      #  Increase the number by 2
       ₄;    #  Push 1000 halved to 500
         .W  #  And sleep that many ms

Javascript (ES6), 48 bytes

f=(i=40)=>alert(i)|i-72&&setTimeout(f,500,i+2)

f()

Based on @ETHproductions answer.

Problem: I can stop the execution by not pressing the ok button. Tested on my Win10 64-bit, Chrome 56.0.2924.87

@SteveFest that is normal with javascript... nothing to downvote about

Ok I see, btw I didn't down vote you

Hmm well sorry..

Never mind :)

so you did? Really confused now

LOL I didn't downvote your

Let us continue this discussion in chat.

Zsh, 34 bytes
for i ({40..72..2})<<<$i&&sleep .5

Attempt This Online!

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


text:
KeyPad Code to Text!
Given a String and an Array as input, your task is to output the text the input String will print when typed on a typical Mobile Keypad. In a Mobile Keypad, a letter is typed by pressing a button n times, where n is the position of where the letter is at on the button's label. So, 22 should output b.

Rules

The Helper Array will contain the Character Map (["  ",".,!","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"]). This will be given to save you some bytes.
The # symbol will toggle case. Initial Case will be lower. So 2#3 should output aD.
The 0 will add a space. So, 202 should output a a.
There will be a space () in the input String to start a new letter that is on the same numeric button. For Example to type aa, the input String will be 2 2.
It is guranteed that the input String will always be a valid KeyPad Code.

Input
You can take input in whatever way your language supports.

Output
You can output the result in any way you want. Function return is also allowed.

Test Cases
#4440555#666888330#999#66688111 -> "I Love You!"
#6#33777 7779990#222#4477744477778627777111 -> "Merry Christmas!"
#44#27 79990#66#3390#999#332777111 -> "Happy New Year!"

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

Closely related

I think the capitalization on year in the last test case is wrong.

Do we have to consider looping? Like, 2222->invalid or 2222->b?

@Maltysen Yes, you are right. I've edited the question. Thanks for pointing it out. :)

Out of interest, do ## or double space need to be handled?

Pyth - 31 bytes
The new key thing cost me too much.
ss.emr!FZk@@QsedthdfndeTrb8cz\#

Test Suite.

JavaScript, 105 99 bytes

f=
(s,a)=>s.replace(/#| ?((.)\2*)/g,(m,n,d)=>d?(l=a[d][n.length-1],x?l:l.toUpperCase()):(x=!x,''),x=1)

a=['  ','.,!','abc','def','ghi','jkl','mno','pqrs','tuv','wxyz']

F=s=>console.log( f(s,a) )
F('#4440555#666888330#999#66688111')
F('#6#33777 7779990#222#4477744477778627777111');
F('#44#27 79990#66#3390#999#332777111');

6 bytes off thanks @Neil.

You can save some bytes by storing the letter in a temporary (e.g. l) and then using c?l:l.toUpperCase().

@Neil. Considering the array is already in lowercase... thanks :)

Perl 6,  119  97 bytes
map based solution 119 bytes
->$_,\a{my$u=0;[~] map {/'#'/??{$u+^=1;|()}()!!(&lc,&uc)[$u](a[.substr(0,1)].substr(.chars-1,1))},.comb(/(\d)$0*|'#'/)}

Try it
substitution based solution 97 bytes
->$_,\a{my$u=0;S:g/(\d)$0*|./{$0??(&lc,&uc)[$u](a[$0].substr($/.chars-1,1))!!($u+^=$/eq'#')x 0}/}

Try it
Expanded:
->     # pointy block lambda

  $_,  # input string
  \a   # helper array

{

  my $u = 0;

  S                        # substitute (implicit against ｢$_｣)
  :global
  /

    | (\d) $0*             # digit followed by same digit
    | .                    # everything else

  /{

    $0                     # is ｢$0｣ set (digit)

    ??                     # if so then
        (&lc,&uc)[$u](     # call either ｢lc｣ or ｢uc｣

          a[$0]            # get the value from the input array
          .substr(         # select the correct character
            $/.chars - 1,
            1
          )

        )

    !!
        (
          $u +^= $/ eq '#' # numeric xor $u if ｢#｣ was matched
        ) x 0              # string repeated zero times (empty string)

  }/
}

JavaScript ES6 - 124 bytes
Golfed:
f=h=>a=>(o=c="")+a.match(/#|(.)\1*/g).forEach(e=>e==" "?0:e=="#"?c=!c:(n=h[e[0]][e.length-1])*(o+=c?n.toUpperCase():n))?o:0;

f=h=>a=>(o=c="")+a.match(/#|(.)\1*/g).forEach(e=>e==" "?0:e=="#"?c=!c:(n=h[e[0]][e.length-1])*(o+=c?n.toUpperCase():n))?o:0;

console.log(f(["  ",".,!","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"])("#4440555#666888330#999#66688111"));
console.log(f(["  ",".,!","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"])("#6#33777 7779990#222#4477744477778627777111"));
console.log(f(["  ",".,!","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"])("#44#27 79990#66#3390999332777111"));

Ungolfed:
f=(a,h)=>{
    //out string
    o="";
    //uppercase or lowercase (initialized as "" and then inverted in golfed version)
    c=0;
    //split it into array of instructions, which are sets of repeated characters, or # solely alone
    a.match(/#|(.)\1*/g).forEach((e)=>{
        e==" "?0:
            e=="#" ? (c=!c) : ( ()=>{ //lambda added because two statements ungolfed, multiplied in the golfed version
                    n=h[e[0]][e.length-1];
                    o+=c?n.toUpperCase():n;
                })()
    })
    return o;
}

JavaScript, 301 bytes
(a,b)=>{u="l";p=[];r="";a.split``.map((c,i)=>p.push(c!=a[i-1]?" "+c:c));p.join``.trim().replace('   ', ' ').split` `.map(l=>{if(l=="#"){u=(u=="l"?b.forEach((y,j)=>b[j]=y.toUpperCase())||"u":b.forEach((y,j)=>b[j]=y.toLowerCase())||"l")}else{if(l!="  "){r+=b[+l[0]][l.length-1]}else{r+=" "}}});return r}

f=(a,b)=>{u="l";p=[];r="";a.split``.map((c,i)=>p.push(c!=a[i-1]?" "+c:c));p.join``.trim().replace('   ', ' ').split` `.map(l=>{if(l=="#"){u=(u=="l"?b.forEach((y,j)=>b[j]=y.toUpperCase())||"u":b.forEach((y,j)=>b[j]=y.toLowerCase())||"l")}else{if(l!="  "){r+=b[+l[0]][l.length-1]}else{r+=" "}}});return r}

console.log(f("#4440555#666888330#999#66688111 ",["  ",".,!","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"]));
console.log(f("#6#33777 7779990#222#4477744477778627777111",["  ",".,!","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"]));
console.log(f("#44#27 79990#66#3390#999#332777111",["  ",".,!","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"]));

I know this is very long, but this is the best I can.

V, 60 bytes
Í /|
Í¨ä©¨±*©/½a[submatch(1)][len(submatch(2))]
Í|
ò/#
g~$x

(There's an unprintable ½<Ctrl+r>a)
Try it online!
Explain

Í /|                                          #Replace all " " with "|"
Í¨ä©¨±*©                                      #Replace all (\d)(\1*)
        /½                                    #With =
          ^Ra                                 #(Inserts the passed array)
             [submatch(1)][len(submatch(2))]  #Index into the array
Í|                                            #Replace all "|" with "" (second ò implied)
ò   ò                                         #Recursively (until breaking)
 /#                                           #Go to the next #
g~$                                           #Toggle case until the of the line
   x                                          #Delete current char (#)


text:
Are you lost yet?
Your task is to implement integer sequence A130826:

an is the smallest positive integer such that an - n is an entire multiple of 3 and twice the number of divisors of (an - n) / 3 gives the nth term in the first differences of the sequence produced by the Flavius Josephus sieve.

Lost yet? Well, it's actually quite easy.
The Flavius Josephus sieve defines an integer sequence as follows.

Start with the sequence of positive integers and set k = 2.
Remove every kth integer of the sequence, starting with the kth.
Increment k and go back to step 2.

fn is the nth integer (1-indexed) that never gets removed.
If – as usual – σ0(k) denotes the number of positive divisors of the integer k, we can define an as the smallest positive integer such that 2σ0((an - n) / 3) = fn+1 - fn.
Challenge
Write a program or function that takes a positive integer n as input and prints or returns an.
Standard code-golf rules apply. May the shortest code win!
Worked examples
If we remove every second element of the positive integers, we are left with
 1  3  5  7  9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 ...

After removing every third element of the remainder, we get
 1  3  7  9 13 15 19 21 25 27 31 33 37 39 ...

Now, removing every fourth, then fifth, then sixth element gets us
 1  3  7 13 15 19 25 27 31 37 39 ...
 1  3  7 13 19 25 27 31 39 ...
 1  3  7 13 19 27 31 39 ...
 1  3  7 13 19 27 39 ...

The last row shows the terms f1 to f7.
The differences of the consecutive elements of the these terms are
 2  4  6  6  8 12

Dividing these forward differences by 2, we get
 1  2  3  3  4  6

These are the target divisor counts.

4 is the first integer k such that σ0((k - 1) / 3) = 1. In fact, σ0(1) = 1.
8 is the first integer k such that σ0((k - 2) / 3) = 2. In fact, σ0(2) = 2.
15 is the first integer k such that σ0((k - 3) / 3) = 3. In fact, σ0(4) = 3.
16 is the first integer k such that σ0((k - 4) / 3) = 3. In fact, σ0(4) = 3.
23 is the first integer k such that σ0((k - 5) / 3) = 4. In fact, σ0(6) = 4.
42 is the first integer k such that σ0((k - 6) / 3) = 6. In fact, σ0(12) = 6.

Test cases
   n     a(n)

   1        4
   2        8
   3       15
   4       16
   5       23
   6       42
   7       55
   8      200
   9       81
  10       46
  11      119
  12      192
  13      205
  14   196622
  15    12303
  16       88
  17      449
  18      558
  19      127
  20     1748
  21   786453
  22       58
  23     2183
  24     3096
  25     1105
  26   786458
  27 12582939
  28      568
  29     2189
  30     2730

Keyword on OEIS: dumb ("an unimportant sequence").

Dumb? It could save the world!

That pun though...

Jelly, 30 29 27 25 bytes
Saved 2 bytes thanks to @Dennis notifying me about Æd, and another 2 bytes for combining the two chains.
RUð÷‘Ċ×µ/
‘Ç_ÇH0Æd=¥1#×3+

Try it online!
This was probably the most fun I've ever had with Jelly. I started from the second line, which calculates fn from n using the formula on OEIS, and is quite beautiful.
Explanation

RUð÷‘Ċ×µ/    Helper link to calculate Fn. Argument: n
R            Get numbers [1..n]
 U           Reverse
        /    Reduce by "round up to next 2 multiples":
   ÷           Divide by the next number
    ‘          Increment to skip a multiple
     Ċ         Ceil (round up)
      ×        Multiply by the next number

‘Ç_ÇH0Æd=¥1#×3+    Main link. Argument: n
‘                  Increment n
 Ç                 Calculate Fn+1
   Ç               Calculate Fn
  _                Subtract
    H              Divide by 2
     0    1#       Starting from 0, find the first candidate for (an-n)/3
                   that satisfies...
      Æd             σ0((an-n)/3)
        =            = (Fn+1-Fn)/2
            ×3     Multiply by 3 to turn (an-n)/3 into an-n
              +    Add n to turn an-n into an

Python 2, 121 119 118 bytes
n=input();r=range(1,4**n);d=s,=r*1,
for k in r:del s[k::k+1];d+=sum(k%j<1for j in r)*2,
print d.index(s[n]-s[n-1])*3+n

Run time should be roughly O(16n) with O(4n) memory usage. Replacing 4**n with 5<<n – which I think is sufficient – would improve this dramatically, but I'm not convinced that it works for arbitrarily large values of n.
Try it online!
Asymptotic behavior and upper bounds of an
Define bn as (an - n)/3, i.e., the smallest positive integer k such that σ0(k) = ½(fn+1 - fn).
As noted on the OEIS page, fn ~ ¼πn2, so fn+1 - fn ~ ¼π(n + 1)2 - ¼πn2 = ¼π(2n + 1) ~ ½πn.
This way, ½(fn+1 - fn) ~ ¼πn. If the actual number is a prime p, the smallest positive integer with p divisors is 2p-1, so bn can be approximated by 2cn, where cn ~ ¼πn.
Therefore bn < 4n will hold for sufficiently large n, and given that 2¼πn < 2n << (2n)2 = 4n, I'm confident there are no counterexamples.
How it works
n=input();r=range(1,4**n);d=s,=r*1,

This sets up a few references for our iterative process.

n is the user input: a positive integer.
r is the list [1, ..., 4n - 1].
s is a copy of r.
Repeating the list once with r*1 creates a shallow copy, so modifying s won't modify r.
d is initialized as the tuple (s).
This first value is not important. All others will hold divisor counts of positive integers.

for k in r:del s[k::k+1];d+=sum(k%j<1for j in r)*2,

For each integer k from 1 to 4n - 1, we do the following.

del s[k::k+1] takes every (k + 1)th integer in s – starting with the (k + 1)th – and deletes that slice from s.
This is a straightforward way of storing an initial interval of the Flavius Josephus sieve in s. It will compute much more than the required n + 1 initial terms, but using a single for loop to update both s and d saves some bytes.
d+=sum(k%j<1for j in r)*2, counts how many elements of r divide k evenly and appends 2σ0(k) to d.
Since d was initialized as a singleton tuple, 2σ0(k) is stored at index k.

print d.index(s[n]-s[n-1])*3+n

This finds the first index of fn+1 - fn in d, which is the smallest k such that 2σ0(k) = fn+1 - fn, then computes an as 3k + 1 and prints the result.

Java 8,  336, 305, 303, 287, 283 279 bytes
57 bytes removed thanks to Kritixi Lithos
Golfed
class f{static int g(int s,int N){return s<1?N+1:g(s-1,N+N/s);}static int h(int k){int u=0,t=1,i;for(;u!=(g(k,k)-g(k,k-1))/2;t++)for(i=1,u=0;i<=t;)if(t%i++<1)u++;return 3*t-3+k;}public static void main(String[]a){System.out.print(h(new java.util.Scanner(System.in).nextInt()));}}

Ungolfed
class f {
    static int g(int s,int N){return s < 1 ? N + 1 : g(s - 1, N + N / s);}

    static int h(int k) {
        int u = 0, t = 1, i;
        // get the first number with v divisors
        while(u != (g(k, k) - g(k, k - 1))/2){
            u = 0;
            for (i = 1; i <= t; i++)
                if (t % i < 1) u++;
            t++;
        }
        // 3*(t-1)+k = 3*t+k-3
        return 3 * t + k - 3;
    }

    public static void main(String[] a) {
        System.out.print(h(new java.util.Scanner(System.in).nextInt()));
    }
}

I think parsing the command-line arguments as an int is shorter than using java.util.Scanner. But even if you're using Scanner, you can do System.out.print(h(new java.util.Scanner().nextInt())) and remove the previous line

@KritixiLithos thx, fixing now...

Inside int h(), you can change it to int v = (g(k,k)-g(k,k-1))/2,u = 0,t = 1;. You can change your if-statement (that is inside your for-loop) from if(t%i==0) to if(t%i<1)

Additionally, you can change your function g to return using ternary operators something like return s==0?N+1:g(s-1,N+N/2)-ish

Also inside function h you can do int v = (g(k,k)-g(k,k-1))/2,u=0,t=1,i (notice the i) so that inside your for-loop you can have for(i=1 instead by dropping the int and saving bytes

@KritixiLithos sorry didn't see comments earlier i just added in your last edit

Also this saves bytes :)

@KritixiLithos i pasted it in and it was returning 1 -> 1,2 -> 5, 3 -> 6 instead of 1 -> 4,2 -> 8,3 -> 15 sorry for my incompetence and again thx for the help

It works for me though

@KritixiLithos this is what i used: static int g(int s,int N){return s==0?N+1:g(s-1,N+N/2);}

It works for me on TIO: https://tio.run/nexus/java-openjdk#TU@xboMwFPwVd6jkVxsSN1sdq3MXFsaqg0sNvEJMhJ9JK8S3UxMxdHh30ulO726tehsCq@dAlrBi6Ik1fMMgNyxgHh3F0bNgzPG1EOql4SFTshDFIYBe/uXae66DeaPJ8IZ3soPsTpkCODzLaI6SjJKoby32jscHM8GcVF0PI0ejNJ4NaRQCsOb0iGcFUQhN6Za9yOmJspPo9HKNn316vTeYBvxiF4uelzSib94/LMzlbyB3yYdI@TWJxFvu3Y1928nmkbDPy8p670a@G9FD7t0PvSUrQJq3rKv6Aw

alright changing...

You can shorten it by removing i++ from the for-loop and by changing the if-statement under it to if(t%i++<1) https://tio.run/nexus/java-openjdk#TU@7boQwEPwVp4jkjQ2HQxeflToNDWWUwiE8NnDmhNdcIsS3E3OiSLEz0mhGO7NVg/WeNYsnS1gxdMRavqOXOxawTDWFyTFvTPZaCPXScp8oWYji5EGv/3LdPdfDstNseMt72UNyp0QBnJ5lMJkkoyTqW4dDzcODmWGJqm7GiaNRGs@GNGDD6RGFOCsIQmiKtx498idKctHr9Ro@h/j5KDCP@MUuFh0vaULXvn9YWMpfT/UlHQOl1ygS77irb@zbzjYNhENaVta5euKHER2krv6ht2gFiOvWbcuzPw

You can remove v=g(... and instead have while(u!=(g(k,k)-g(k,k-1))/2) https://tio.run/nexus/java-openjdk#TY8xb4MwEIX/ijtU8tWGxMkWx@rchYWx6uBSA1eIifA5aYX47dREDB3uPen0Pb27peptCKyeAlnCiqEn1vBVg1y1gGl0FEfPgjH710KoU8NDpmQhil0APf/LtY9cB9Nq0ewlGSVR31vsHY9Phje8kx1kD8sUwO4AU@J0PYwcjdJ4NqQBa07PKMRZQRRCU5p5u@H4QtlRdHq@xs8@tW7ltwG/2MWi5yWN6Jv3DwtT@RvIXfIhUn5NS@It9@7Ovu3N5pGwz8vKeu9GvoHoIffuh94SCpA@m5fl8Ac

In int g() I modified the return statement so that I used s<1 instead. Also in int h() I changed the while loop to a for loop and moved things around so that it would be shorter: https://tio.run/nexus/java-openjdk#TY@xboQwEER/xSkieWPjO4fuDEqdhoYySuEQ4DZw5mSvL4kQ307MiSLNjLQ7T6NZm9GGwLo5kCVsGDpiPd80yE0rmH1L0TsWCv1SCX3qeci0rER1CGCWf9j5jg0wbxbLo6RSSzTd5LmJDyXv@SAHyO6WaYDDsyEhYPtjSibCYFGSAew4PaIQhYYohNn78yfKcjGY5Ro/xlS5N98m/GQXi47X5NH1b@8W5vo3UHtRUyR1TUfiZ@7ab/Zlb1ZFwlHVjXWu9XwPogPl2h96TVGANGtZ1/z4Bw

@KritixiLithos lol at this point u should just post this as ur own separate solution

Mathematica, 130 116 106 103 bytes
3Catch@Do[f=#2⌈#/#2+1⌉&~Fold~Reverse@Range@#&;If[Tr[2+0Divisors@k]==f[#+1]-f@#,Throw@k],{k,∞}]+#&

or
3Catch@Do[f=#2⌈#/#2+1⌉&~Fold~Reverse@Range@#&;If[2DivisorSum[k,1&]==f[#+1]-f@#,Throw@k],{k,∞}]+#&

Ended up being almost identical to @Pietu1998's Jelly code...
Explanation
Catch@

Catch whatever is Throw-ed (thrown).
Do[ ... ,{k,∞}]

Infinite loop; k starts from 1 and increments every iteration.
f= ...

Assign f:
Reverse@Range@#

Find {1, 2, ... , n}. Reverse it.
#2⌈#/#2+1⌉&

A function that outputs ceil(n1/n2 + 1) * n2
f= ... ~Fold~ ... &

Assign f a function that recursively applies the above function to the list from two steps above, using each output as the first input and each element of the list as the second input. The initial "output" (first input) is the first element of the list.
Tr[2+0Divisors@k]==f[#+1]-f@#

Check whether twice the number of divisors of k is equal to f(n + 1) - f(n).
If[ ... ,Throw@k]

If the condition is True, Throw the value of k. If not, continue looping.
3 ... +#&

Multiply the output by 3 and add n.
130 byte version
Catch@Do[s=#+1;a=k-#;If[3∣a&&2DivisorSigma[0,a/3]==Differences[Nest[i=1;Drop[#,++i;;;;i]&,Range[s^2],s]][[#]],Throw@k],{k,∞}]&

05AB1E, 35 34 39 bytes
1Qi4ë[N3*¹+NÑg·¹D>‚vyy<LRvy/>îy*}}‚Æ(Q#

It looks awful, so is runtime performance. It takes several seconds for input that yield small values. Don't try numbers like 14; it will eventually find the result but it would take ages.
Explanation
It works as 2 sequentially called programs. The first one computes Fn+1 - Fn and the second one determines an based on its definition, using a bruteforce approach.
Fn+1 - Fn is evaluated for each iteration even though it is loop invariant. It makes the code time inefficient, but it makes the code shorter.
Try it online!

I'm not sure I understand. Why can't it compute the sieve above 65,536?

It comes from the fact that it generates all integers between 0 and 65536 (žHL) and then filters out the values that don't satisfy the sieve constraints. I think the first part of this program should be entirely rewritten with a completely different approach to make it golfable.

Unless there are limitations (like fixed width integers) that prevent you from doing so, answers are expected to work for any input, given enough time and memory.

That's why I came up with another sieve algorithm. It might be golfable but I haven't found better in 05AB1E. However there is a counterexample to given enough time and memory, since I already saw several answers on other questions that ran so slowly that it was nearly impossible to say whether they produced the right output or not. For this reason I put the sieve computation aside from the loop and it cost me 2 bytes.

No need to make your code efficient. You can make the golfed/slow implementation your submission and include the faster/longer one as a side note. I'm afraid I have to insist on the dynamic limit though, even if it costs a byte.

Perl 6, 154 149 136 107 bytes
->\n{n+3*first ->\o{([-] ->\m{m??&?BLOCK(m-1).rotor(m+0=>1).flat!!1..*}(n)[n,n-1])/2==grep o%%*,1..o},^Inf}

Ungolfed:
-> \n {                    # Anonymous sub taking argument n
  n + 3 * first -> \o {    # n plus thrice the first integer satisfying:
    (                      #
      [-]                  #
      -> \m {              # Compute nth sieve iteration:
        m                  # If m is nonzero,
          ?? &?BLOCK(m-1).rotor(m+0=>1).flat # then recurse and remove every (m+1)-th element;
          !! 1..*          # the base case is all of the positive integers
      }                    #
      (n)                  # Get the nth sieve
      [n,n-1]              # Get the difference between the nth and (n-1)th elements (via the [-] reduction operator above)
    ) / 2                  # and divide by 2;
    ==                     # We want the number that equals
    grep o %% *, 1..o      # the number of divisors of o.
  }
  ,^Inf
}


text:
ASCII Hilbert Curve
Given an integer n output the nth iteration of the Hilbert Curve in ASCII using the characters _ and |.
Here are the first 4 iterations:
n=1
 _
| |

n=2
 _   _
| |_| |
|_   _|
 _| |_

n=3
 _   _   _   _
| |_| | | |_| |
|_   _| |_   _|
 _| |_____| |_
|  ___   ___  |
|_|  _| |_  |_|
 _  |_   _|  _
| |___| |___| |

n=4
 _   _   _   _   _   _   _   _
| |_| | | |_| | | |_| | | |_| |
|_   _| |_   _| |_   _| |_   _|
 _| |_____| |_   _| |_____| |_
|  ___   ___  | |  ___   ___  |
|_|  _| |_  |_| |_|  _| |_  |_|
 _  |_   _|  _   _  |_   _|  _
| |___| |___| |_| |___| |___| |
|_   ___   ___   ___   ___   _|
 _| |_  |_|  _| |_  |_|  _| |_
|  _  |  _  |_   _|  _  |  _  |
|_| |_| | |___| |___| | |_| |_|
 _   _  |  ___   ___  |  _   _
| |_| | |_|  _| |_  |_| | |_| |
|_   _|  _  |_   _|  _  |_   _|
 _| |___| |___| |___| |___| |_

Clarifications

My question is similar to Draw the Hilbert Curve and Draw the Hilbert curve using slashes.
The conversion between underscores (_) and vertical bars (|) is u=2*v-1 where  u is the number of _s and v is the number of |s.
To maintain consistency with my original post the curve must start and end at the bottom.
You can have a full program or a function.
Output to stdout (or something similar).
You can have leading or trailing white-spaces, the output just needs to line up so that it looks like the examples.
This is code-golf so shortest answer in bytes wins.

Could you please include a definition of the Hilbert Curve in you post, and the exact specifications for how the ASCII version is constructed?

@Bobas_Pett: Not [tag:kolmogorov-complexity]

@shooqie there's some debate on that on meta

@Loovjo I added in a point about the lengths of underscores (_) and vertical bars (|) under "Clarifications", if more information or a rigorous definition is still needed please tell me.

@shooqie i removed the tag

Your examples show the ends of the hilbert curve at the bottom, but this not specified. Is it a requirement that ends be at the bottom, or can it be rotated 90 / 180 degrees? If variation is allowed, is it acceptable for different values of n to have the ends in different places?

@LevelRiverSt sorry this wasn't specified when i first posted the question I made edit under "Clarifications".

I ran into this purely by accident, while trying to find something else. (More serious and nowhere as fun.) Thanks for making my day!

Befunge, 444 368 323 bytes
&1>\1-:v
0v^*2\<_$00p>
_>:10p\:20pv^_@#-*2g00:+1,+55$
^!-<v*2g000<>$#<0>>-\:v
g2*^>>10g20g+v \ ^*84g_$:88+g,89+g,\1+:00
v#*!-1g02!g01_4^2_
>::00g2*-!\1-:10g-\20g-++>v
87+#^\#p01#<<v!`g01/2\+76:_
vv1-^#1-g01:\_$:2/20g`!
_ 2/^>:10g#vv#`g02/4*3:\+77
v>0p^^/2:/2_
<^2-1-g02</2`#*3:
0g+10p2*:^*3_1
! "#%$
%$"#!
 !!##%
|||_
 _ __

Try it online!
The typical approach to drawing the Hilbert Curve is to follow the path as a series of strokes and turns, rendering the result into a bitmap or some area of memory, and then writing out that rendering when the path is complete. This is just not feasible in Befunge when we only have 2000 bytes of memory to work with, and that includes the source of the program itself.
So the approach we've taken here is to come up with a formula that tells us exactly which character to output for a given x,y coordinate. To understand how this works, it's easiest to ignore the ASCII rendering to start with, and just think of the curve as made up of box characters: ┌, ┐, └, ┘, │, and ─.
When we look at the curve like that, we can immediately see that right hand side is an exact mirror of the left hand side. Characters on the right can simply be determined by looking up their partner on the left, and reflecting it horizontally (i.e. occurrences of ┌ and ┐ are swapped, as are └ and ┘).

Then looking at the bottom left corner, again we can see that the lower half is a reflection of the top half. Thus the characters on the bottom are simply determined by looking up their partner above, and reflecting it vertically (i.e. occurrences of ┌ and └ are swapped, as are ┐ and ┘).

The remaining half of this corner is a little less obvious. The right hand block can be derived from a vertical reflection of the block diagonally adjacent to it.

And the left hand block can be derived from a vertical reflection of the block in the very top left of the full curve.

At this point, all we're left with is the top left corner, which is just another Hilbert Curve one iteration lower. In theory, we should now just need to repeat the process again, but there's a bit of a catch - at this level, the left and right halves of the block aren't exact mirrors of each other.
So at anything other than the top level, the bottom corner characters need to be handled as a special case, where the ┌ character is reflected as ─, and the │ character is reflected as └.

But other than that, we really can just repeat this process recursively. At the last level we hardcode the top left character as ┌, and the character below it as │.

Now that we have a way to determine the shape of the curve at a particular x,y coordinate, how do we translate that into the ASCII rendering? It's actually just a simple mapping that translates each possible tile into two ASCII characters.

┌ becomes  _ (space plus underscore)
┐ becomes    (two spaces)
└ becomes |_ (vertical bar plus underscore)
┘ becomes |  (vertical bar plus space)
│ becomes |  (again a vertical bar plus space)
─ becomes __ (two underscores)

This mapping isn't intuitive at first, but you can see how it works when looking at two corresponding renderings side by side.

And that's basically all there is to it. Actually implementing this algorithm in Befunge is another problem altogether, but I'll leave that explanation for another time.

C, 267 bytes
const n=4,s=1<<n,a[]={1,-s,-1,s};l,p,q;
t(d){d&=3;p-q||printf("%.2s",&"__|      _|       |___ _|_| | | "[l*8+d*2]);p+=a[l=d];}
h(d,r,n){n--&&(h(d+r,-r,n),t(d+r),h(d,r,n),t(d),h(d,r,n),t(d-r),h(d-r,-r,n));}
main(){for(;p=s*s-s,l=1,q<s*s;++q%s||putchar(10))h(0,1,n),t(3);}

Try it online!
h() uses recursion to generate the strokes of hlibert curve. t() only prints out the stroke character if the pen position p is equal to the current output position q.
This is inefficient but simple.
If the curve starts at top-left, the code can be reduced to 256 bytes.

Suggest puts("") instead of putchar(10) and "..."+l*8+d*2 instead of &"..."[l*8+d*2] and n--?h(d+r...-r,n):0 instead of n--&&(h(d+r...-r,n))


text:
Maths Metagolf Mania!
Mathemania Specs:
Every piece of Mathemania code starts off with the number 2. From the 2, you can do the following operations:

e: Exponentiation. This command's default is squaring the number.
f: Factorial. This command's default is using the single factorial on the number (using f on 2 = 2! = 2).
r: Root. This command's default is square-rooting the number.
c: Ceiling function.
l: Floor function.

To generate a number in Mathemania, you must string together these commands, which are performed left-to-right on the number 2.
Examples:
ef = (2^2)! = 4! = 24
rl = floor(sqrt(2)) = floor(1.4...) = 1
er = sqrt(2^2) = sqrt(4) = 2
efrrc = ceil(sqrt(sqrt((2^2)!)))
      = ceil(sqrt(sqrt(24)))
      = ceil(sqrt(4.89...))
      = ceil(2.21...)
      = 3

The e, f and r commands can be altered by extra Mathemania commands (which also start off with 2 as its "base" number) to generate different exponentiations, factorials and roots by placing brackets after the altered function and placing the Mathemania commands inside it.
For example, to cube a number instead of squaring it, you can put the command for 3 after e like so:
e(efrrc) -> cube a number, "efrrc" = 3

NOTE: for our purpose, the factorial command (f) start off with 2 as a single factorial. So if you do f(efrrc), that will get evaluated to a double factorial, not a triple factorial.
For n-factorials (e.g. double factorials = 2-factorial, triple factorial = 3-factorial etc.), the base number is multiplied by the number that is n less than it, and n less than that, and so on until the final number cannot be subtracted by n without becoming 0 or negative.
For example:
7!! = 7 * 5 * 3 * 1 = 105 (repeatedly subtract 2, 1 is the last term as
                           1 - 2 = -1, which is negative)
9!!! = 9 * 6 * 3 = 162 (repeatedly subtract 3, 3 is the last term as
                        3 - 3 = 0, which is 0)

For more information, see here.
You can insert it anywhere, and it will get treated by Mathemania as a single function:
e(efrrc)rc = ceil(sqrt(2^3))
           = ceil(2.82...)
           = 3

You're also allowed to nest these inside one another:
e(e(e)) = e(4th power)
        = (2^4)th power
        = 16th power

For an interpreter of Mathemania code, click here (cheers, @BradGilbertb2gills!)
Task:
Your task is to create a program that, when given a positive integer n as input, generates a Mathemania program that when executed, returns n.
However, the Mathemania programs that you generate must be as small (golfed) as possible, and your final score is determined by the sum of the number of bytes in the generated Mathemania programs of the sample, which are the integers 10,000 to 10,100. The lowest score wins.
Rules and specs:

Your program must output a valid Mathemania program for any positive integer, but only the numbers between 10,000 and 10,100 will be tested.
You are not allowed to output Mathemania programs that do not result in an integer. If you do so, your program is disqualified.
For the commands e, f and r, the Mathemania code inside those functions (e.g. e(efrrc), where the efrrc is the code inside the function) must evaluate to a positive integer above 2. If your program doesn't follow this rule, it is disqualified as well.
Your program must return a Mathemania program for any one of the 101 test integers in at most 30 minutes on a modern laptop.
Your program must return the same solution for any integer every time it is run. For example, when a program is given an input 5 and it outputs efrc, it must output that every time the input 5 is given.
You may not hard-code any solutions for any positive integer.
In order to fully maximise golfing potential in your output, your program should be able to handle arbitrarily large integers. It is not a requirement, though good luck if your language doesn't support this.

This is metagolf, so lowest score wins!

I wrote an evaluator for this language in Perl 6 on TIO Nexus.

@BradGilbertb2gills Wow, thanks! I'll put a link in the challenge.

If the input is ef for example, is the code allowed to "skip" and just output the result before the ef operation?

@devRicher If you mean that the program "ef" is hard coded beforehand, then under the current rules, yes you're allowed to do that, because "ef" is not in the range of 10,000 to 10,100. I'm not sure that's what you meant though, and I might change the rules because hardcoding makes the challenge way too easy, IMO.

I've been writing a program for this challenge for the past few hours. I think I have working code, but I can't exactly test it properly because some of the numbers generated by factorials are absolutely huge and Python (where I have my program and interpreter) can't take their square root. I'm not quite sure what to do with the program at this point.
On a side note, I originally misread and thought ALL 101 test cases had to fit within the time limit, which seemed near impossible. Any one seems a lot more reasonable.

@notjagan Is your program really slow or unable to function properly when taking the square roots?

@Qwerp-Derp The program to generate the Mathmania code itself isn't super slow; out of the few numbers I've tested between 10000 and 10100, it takes at most a few minutes. However, I'm unable to verify the outputted code for the more complex test numbers due to the sheer size of the factorials generated while running. That is, when my interpreter encounters these large numbers and attempts to take the square root, it exceeds the limit for a float in Python. I can post my code as an answer, but I am unsure of whether it totally works because I can't verify a majority of the test cases.

@notjagan Just post your answer along with its score - I included an interpreter in the challenge itself.

@Downvoters: can you please explain your reasoning in the comments? Thanks.

Python 3.5, Score of ??
As of now I don't have the output for all 101 inputs, but once I run the program for all the test cases I will update with my score.
from math import *

memoized = {}
same = {}

def _(mathmania, n):
    memoized[n] = mathmania
    return mathmania

def is_prime(n):
    if n == 2:
        return True
    if n % 2 == 0 or n <= 1:
        return False
    for divisor in range(3, int(sqrt(n)) + 1, 2):
        if n % divisor == 0:
            return False
    return True

def pair_key(pair):
    low, high = pair
    diff = high - low
    if diff == 0:
        return 100
    low_done, high_done, diff_done = low in memoized, high in memoized, diff in memoized
    if high_done and memoized[high] == None or low_done and memoized[low] == None:
        return -1
    return (high_done + diff_done + (diff + 1 == low)) * 33 + low / high

def major_pairs(n):
    for i in range(n, int(sqrt(n)), -1):
        d = n / i
        if i - d < d - 1:
            break
        if d == int(d):
            yield (int(d), i)

def fact_key(pair):
    i, f = pair
    if i in memoized:
        if memoized[i] == None:
            return -1
        return 1
    return i / f

def near_fact(n, level):
    s = 4
    if n in same:
        s = same[n]
    for i in range(s, n ** 2 ** level):
        f = factorial(i)
        if f > (n - 1) ** 2 ** level:
            if f < (n + 1) ** 2 ** level:
                same[n] = i
                yield (i, f)
            else:
                return

def generate_mathmania(n):
    if n in memoized and memoized[n] != None:
        return memoized[n]
    memoized[n] = None
    binx = log(n, 2)
    if binx == int(binx):
        if binx == 2:
            return _("e", n)
        if binx == 1:
            return _("er", n)
        if binx == 0:
            return _("rl", n)
        return _("e(" + generate_mathmania(int(binx)) + ")", n)
    sq = sqrt(n)
    if sq == int(sq):
        return _(generate_mathmania(int(sq)) + "e", n)
    low, high = max(major_pairs(n), key=pair_key)
    if pair_key((low, high)) == -1:
        level = 1
        while True:
            try:
                i, f = max(near_fact(n, level), key=fact_key)
            except:
                level += 1
                continue
            if fact_key((i, f)) == -1:
                return _(generate_mathmania((n - 1) ** 2 + 1) + "rc", n)
            if f == n ** 2 ** level:
                return _(generate_mathmania(i) + "f" + "r" * level, n)
            if f < n ** 2 ** level:
                return _(generate_mathmania(i) + "f" + "r" * level + "c", n)
            return _(generate_mathmania(i) + "f" + "r" * level + "l", n)
    if low != 1:
        if low == high:
            return _(generate_mathmania(low) + "e", n)
        if high - low == 1:
            return _(generate_mathmania(high) + "f", n)
        return _(generate_mathmania(high) + "f(" + generate_mathmania(high - low + 1) + ")", n)
    good = None
    for i in range(n ** 2 - 1, (n - 1) ** 2, -1):
        if i in memoized:
            return _(generate_mathmania(i) + "rc", n)
        if not is_prime(i):
            good = i
    if good:
        return _(generate_mathmania(good) + "rc", n)
    for i in range((n + 1) ** 2 - 1, n ** 2, -1):
        if i in memoized:
            return _(generate_mathmania(i) + "rl", n)
        if not is_prime(i):
            good = i
    if good:
        return _(generate_mathmania(good) + "rl", n)
    return _(generate_mathmania((n - 1) ** 2 + 1), n)

Additionally, I was unable to verify the outputs of some of the test cases I tried due to sheer number size, and at that point @BradGilbertb2gills's online interpreter times out. Hopefully all the outputs work.

I have an interpreter in Python 2 (possibly 3) which should be able to handle arbitrary precision here. Copy and paste it into your IDE to run it.

What were some of the outputs so that I could possibly optimize it.