text:
Pronounce numbers
Concept
Remembering numbers can be difficult. Remembering a word may be easier. In order to memorize big numbers, I created a way to pronounce them in a leetspeak-like way.
Rules
Each digit is first replaced by its corresponding letter:
0 => O
1 => I
2 => R
3 => E
4 => A
5 => S
6 => G
7 => T
8 => B
9 => P

After the replacement, two additional things are done to improved pronunciation:

Between two consonants, a U is added.
Between two vowels, a N is added.

Examples/test cases
512431 => SIRANENI
834677081 => BENAGUTUTOBI
3141592 => ENINANISUPUR
1234567890 => IRENASUGUTUBUPO
6164817 => GIGABIT

What's impossible

Letters and numbers mixed in the same word
Two successive consonants or two successive vowels
Letters that are not in the list above
Other characters

Rules
The goal of this code-golf is to create a 2-way translator for this concept.

Your program must first understand by itself if it's letter-to-number or number-to-letter translation.
It must check for the entry to be properly formed.
If everything is correct, display the translation.
Else, display an error message, nothing, return a falsey value or crash the program.

Details

The input number/string can be entered in whatever format you want (stdin, argument, ...)
This is code-golf, so shortest answer wins.
Standard loopholes are forbidden.

Shouldn't GIGATESTER be GIGATESUTER?

Usually, we don't ask for the entry to be 'properly formed', as it's just extra code for no good reason (see the meta question for good challenge recommendations). Additionally, what does 'properly formed' mean?

If input validation is required, you should include a decent batch of test cases of invalid inputs (especially letter-only inputs that are almost valid). I expect that this will actually be the main part of the challenge in many languages.

What characters can appear in the input?

And if you want some long words that can actually be formed by this process, there's "separator", "originator", "regenerate" or "peritonitis" (ugh). One of the longest words with u is "superego" and words containing both u and n are "butane", "purine", "supine" (there might be longer ones for all of these, Mathematica's WordList isn't super exhaustive).

A constraint on alphabetic inputs that you didn't mention is that they can't start or end with u or n and that they can't contain nu or un.

Can we use lower-case letters instead of upper-case?

I agree with @MartinEnder that you should add some test cases for invalid cases, like AB23; AEI; BB; Z; ACE; giga; !@#$; -123; etc. Also, based on the validation rules, we can convert 6164735732 => GIGATESTER, but GIGATESTER will result in a false value, because of ST (two successive consonants rule). The way your challenge is currently set up, the main part of the challenge is the validation, instead of the conversion. I'm fine with that, but the validation should be defined a bit better in that case.

Your program must first undersand by itself if it's letter-to-number or number-to-letter translation. So the translation has to be two-way? The preceding text and the test cases suggest only number to letter

Will there always be multiple digits to a number? Do we need to be able to handle single digit numbers?

Boo-urns to input validation!

@okx, seems pretty clear within the scope of the challenge. and seems like a legit criteria for a slightly tougher challenge. still i don't see the answers being unreasonably long.

@Shaggy, you dont really have to validate the input. one way you could handle it is you try to convert it and if it doesn't follow the rules you return early

Related (to my earlier) question: For the letter input, do we need to be able to handle a single letter? Or, to some up, can we assume that the input will always be more than one character long?

39 83, 2081 243 63081. 22 81 201 2093.

Would still like to know what to do with words like NUN which are not ruled out by the list of criteria but don't correspond to any number.

I'd say that NUN is NaN

JavaScript (ES6), 130 bytes
Takes input as a string in both translation ways. Returns either the translation as a string or false in case of an invalid input.
f=(n,k)=>(t=n.replace(/./g,(c,i)=>1/n?(!i|p^(p=27>>c&1)?'':'UN'[p])+s[c]:~(x=s.search(c))?x:'',p=s='OIREASGTBP'),k)?t==k&&n:f(t,n)

Demo

f=(n,k)=>(t=n.replace(/./g,(c,i)=>1/n?(!i|p^(p=27>>c&1)?'':'UN'[p])+s[c]:~(x=s.search(c))?x:'',p=s='OIREASGTBP'),k)?t==k&&n:f(t,n)

console.log(f("512431"))          // SIRANENI
console.log(f("834677081"))       // BENAGUTUTOBI
console.log(f("3141592"))         // ENINANISUPUR
console.log(f("1234567890"))      // IRENASUGUTUBUPO
console.log(f("6164735732"))      // GIGATESUTER

console.log(f("SIRANENI"))        // 512431
console.log(f("BENAGUTUTOBI"))    // 834677081
console.log(f("ENINANISUPUR"))    // 3141592
console.log(f("IRENASUGUTUBUPO")) // 1234567890
console.log(f("GIGATESUTER"))     // 6164735732

console.log(f("AB23"))            // false
console.log(f("AEI"))             // false
console.log(f("ZZ"))              // false

If it doesn't work perfectly, don't post it.

Hopefully now working as expected.

... or crash when there are reserved regexp characters in input. Still valid though

Japt, 61 59 92 85 84 bytes

I'm offline for most of the (long) weekend, if any more issues are discovered with this, please ask a mod to delete it for me until such a time as I can fix it.

Takes input as a string for both operations and returns a string for both as well or false for invalid input.Assumes number inputs will always contain multiple digits, add 1 byte replacing UÉ with Un<space> if that's not valid. Returns false for test case GIGATESTER but, according to the rules, that should be invalid input.

V="OIREASGTBP"UÉ?¡VgXÃe"%v"²_i1'NÃe"%V"²_i1'UÃ:!Uè"%v%v|%V%V|[^{V}NU]" ©Ur"N|U" £VaX

Try it: Numbers -> Letters or Letters -> Numbers

2 4 bytes saved thank to obarakon, who also convinced me to take this up again after I abandoned it earlier. I wish he hadn't!
33 26 25(!) bytes sacrificed implementing a quick fix (i.e., yet to be fully golfed) to check input validity.

Explanation
(Yet to be updated to the latest version)
                          :Implicit input of string U.
V="..."                   :Assign the string of letters to variable V, in order.
UÉ                        :Subtract 1 from U, which will give a number (truthy) if the input is a number or NaN (falsey) if the input is a string.
?                         :If it's a number then
¡                         :    Map over the input string, replacing each character (digit) with ...
VgX                       :      the character in string V at index X, the current digit.
Ã                         :    End mapping.
e                         :    Recursively replace ...
"%v"²                     :      every occurrence of 2 vowels (RegEx) ...
_i1'N                     :      with the current match with an "N" inserted at index 1.
Ã                         :    End replacement.
e                         :    Another recursive replacement of ...
"%V"²                     :      every occurrence of 2 non-vowel characters (i.e., consonants) ...
_i1'U                     :      with the current match with a "U" inserted at index 1.
Ã                         :    End replacement.
:                         :Else, if it's a string then
Uè"%v%v|%V%V|[^{V}NU]"    :    Count the number of matches of 2 successive vowels OR 2 successive non-vowels OR any character not in contained in string V plus N & U.
                          :    (The longest part of this code is the fecking input validation!)
?                         :    If that count is greater than 0 then
T                         :       Return 0.
:                              Else
Ur"N|U"                   :        Replace every occurrence of "N" OR "U" in string U with nothing.
£                         :        Map over the string, replacing each character (letter) with ...
VaX                       :         the index of the current character X in string V.
                          :Implicit output of resulting string

Doesn't seem to handle invalid input such as AEI

@Emigna: Ah, goddamnit! You'd imagine, after getting burned by the first "Rule" initially, we would have thought to read the rest of the rules! :\  I took the "What's impossible" section to imply we wouldn't have to handle any of those points.Fix coming shortly.

Python 3, 147 bytes
lambda c:c in"0134"
def f(n):
 o="";a=b=1-x(n[0])
 for i in n:
  a=x(i)
  if a==b:o+="UN"[a]
  o+="OIREASGTBP"["0123456789".index(i)];b=a
 print(o)

Try it online!

Java (OpenJDK 8), 416 410 399 382 376 370 bytes
-2 bytes thanks to @Cyoce
-17 more bytes thanks to an idea by @Cyoce
-6 bytes thanks to @KevinCruijssen
s->{String c="[RSGTBP]",v="[OIEA]",o="([256789])",e="([0134])";boolean b=s.matches("(c$|v$|(c|vN)(?=v)|(cU|v)(?=c))+".replace("c",c).replace("v",v));int i=-1;for(s=b?s.replaceAll("[UN]",""):s.matches("[0-9]+")?s.replaceAll(e+"(?="+e+")","$1N").replaceAll(o+"(?="+o+")","$1U"):i/0+"";i<9;s=b?s.replace(v,c):s.replace(c,v)){c=++i+"";v="OIREASGTBP".charAt(i)+"";}return s;}

Try it online!
Ugh, java replacement is so verbose.
Function which takes a string and returns the string translated from number -> letter or vice versa.  Crashes on invalid input (you can see this in the tio example where it outputs the correct values for the first 10 test cases and then crashes with a divide by zero error which shows in the debug view)
Ungolfed (the first and last term of the for loop are pulled out for readability)
s-> {
    String c="[RSGTBP]", v="[OIEA]", o="([256789])", e="([0134])";
    boolean b=s.matches("(c$|v$|(c|vN)(?=v)|(cU|v)(?=c))+".replace("c",c).replace("v",v)); // lovely regex, explained below
    int i=-1;
    s= b?
        s.replaceAll("[UN]",""); // remove N's and U's
        :s.matches("[0-9]+")?
        s.replaceAll(e+"(?="+e+")","$1N").replaceAll(o+"(?="+o+")","$1U"); // add N's and U's for separating vowels and consonants
        :i/0+""; // throw an error, looks like a sting for the ternary
    for(;i<9;) {
        c=++i+"";
        v="OIREASGTBP".charAt(i)+"";
        s=b?s.replace(v,c):s.replace(c,v); // if it started with numbers, go to letters, or vice versa
    }
    return s;
}

The regex for matching the numbers is simple, but here is the regex for matching the letters to numbers case
(c$|v$|(c|vN)(?=v)|(cU|v)(?=c))+
(                             )+   every part of the word is
 c$                                a consonant at the end of the word
   |v$                             or a vowel at the end of the word
      |(c|vN)(?=v)                 or a consonant or a vowel + N followed by a vowel
                  |(cU|v)(?=c)     or a consonant + U or a vowel followed by a consonant

with c = [RSGTBP] and v = [OIEA]

Not that it significantly improves your massive byte count, but you can remove the parentheses around (s)->

@Cyoce every byte helps

since all your branches of the if statement are assignments (which return a value),  try replacing the if...else if...else with the conditional operator ?:, prefacing it with Object _= to make it a valid statement. Not sure if this would actually help the byte count, but I think it will.

Two small things you can golf. You can remove the String t, because you only use it once. So t.charAt(i)+"" becomes "OIREASGTBP".charAt(i)+"" (-4 bytes). And you can place the last line inside the for-loop after the i<9; inside the for-loop declaration. So it becomes for(;i<9;s=b?s.replace(v,c):s.replace(c,v)){ (-1 byte). Oh, and you can put the s=b?... that comes right after the int i=-1; inside the for-loop as well: for(s=b?...;i<9;... (-1 byte).

Java 8, 312 308 304 301 294 290 bytes
s->{String r="",x="([AEIOU])",y="([BGNPRST])",z="0O1I2R3E4A5S6G7T8B9P";for(int c:s.getBytes())r+=c!=78&c!=85?z.charAt((c=z.indexOf(c)+(c<58?1:-1))<0?0:c):"";return s.matches("(("+x+y+")*"+x+"?)|(("+y+x+")*"+y+"?)|\\d*")?r.replaceAll(x+"(?="+x+")","$1N").replaceAll(y+"(?="+y+")","$1U"):"";}

-4 bytes (308 → 304) for a bug-fix (doesn't happen often that the byte-count decreases when I fix a bug in my code.. :D)
EDIT: Uses a different approach than @PunPun1000's Java answer by first creating the return-String in a for-loop over the characters, and then uses a more abstract regex to validate it in the return-ternary (the input is either all digits, or are the given vowels and consonants alternating (so without any adjacent vowels nor consonants).
Explanation:
Try it here.
s->{                                   // Method with String parameter and String return-type
  String r="",                         //  Result-String
    x="([AEIOU])",y="([BGNPRST])",     //  Two temp Strings for the validation-regex
    z="0O1I2R3E4A5S6G7T8B9P";          //  And a temp-String for the mapping
  for(int c:s.getBytes())              //  Loop over the characters of the input-String
    r+=                                //   Append to the result-String:
       c!=78&c!=85?                    //    If the character is not 'N' nor 'U':
        z.charAt(                      //     Get the character from the temp-String `z`
         (c=z.indexOf(c)+              //      by getting the character before or after the current character
            +(c<58?1:-1))              //      based on whether it's a digit or not
             <0?0:c)                   //      and a 0-check to prevent errors on incorrect input like '!@#'
       :                               //    Else:
        "";                            //     Append nothing
                                       //  End of loop (implicit / single-line body)
  return s.matches("(("+x+y+")*"+x+"?)|(("+y+x+")*"+y+"?)|\\d*")?
                                       //  If the input is valid
                                       //  (Only containing the vowels and consonants of `x` and `y`, without any adjacent ones. Or only containing digits)
    r                                  //   Return the result
     .replaceAll(x+"(?="+x+")","$1N")  //    after we've added 'N's if necessary
     .replaceAll(y+"(?="+y+")","$1U")  //    and 'U's if necessary
   :"";                                //  Or return an Empty String if invalid
}                                      // End of method

The validation regex:
(([AEIOU][BGNPRST])*[AEIOU]?)|(([BGNPRST][AEIOU])*[BGNPRST]?)|\\d*

PHP; 129 127 267 259 228 bytes
$l=IOREASGTBP;$n=1023456789;ctype_digit($s=$argn)?:$s=preg_replace("#U|N#","",strtr($o=$s,$l,$n));for($r=$c=($t=strtr($s,$n,$l))[$i++];$d=$t[$i++];)$r.=((trim($c,AEIO)xor$x=trim($d,AEIO))?X:UN[!$x]).$c=$d;echo$o?$o==$r?$s:"":$r;

Run as pipe with -nR or try it online.
breakdown
$l=IOREASGTBP;$n=1023456789;
# if not digits, translate letters to digits and remember original
ctype_digit($s=$argn)?:$s=preg_replace("#U|N#","",strtr($o=$s,$l,$n));
# translate digits to letters:
for($r=$c=($t=strtr($s,$n,$l))                      # result = first letter
    [$i++];$d=$t[$i++];)                            # loop through letters
    $r.=((trim($c,AEIO)xor$x=trim($d,AEIO))?"":UN[!$x]) # append delimiter if needed
        .$c=$d;                                         # append next letter
#
echo
    $o              # if original was remembered,
        ?$o==$r         # compare original to final result
            ?$s         # if equal, print digits
            :X          # else print X (as error message)
        :$r;        # else print letters

sed, 123 bytes
s/[0134]/_&_/g
s/[25-9]/=&=/g
ta
y/OIREASGTBPU/0123456789N/
s/N//g
q
:a
s/__/N/g
s/==/U/g
y/0123456789_/OIREASGTBP=/
s/=//g

Explanation
First, we surround digits with _ (for vowels) or = (for consonants).
If we didn't make any substitutions, we are converting letters to digits, so it's a simple substitution, and delete U and N.  Then quit.
Otherwise, we branch to label a, where we deal with consecutive vowels and then consecutive consonants.  Then transform digits to letters, and delete the marker characters we introduced in the first step.

Perl 5 -p, 155 bytes
$v="AEIO]";$c="RSGTBP]";$,=OIREASGTBP;eval"/[^0-9$,UN]|[^$v N|N[^$v|[^$c U|U[^$c|^[NU]|[NU]\$/x||y/0-9$,UN/$,0-9/d+s/[$v\\K(?=[$v)/N/g+s/[$c\\K(?=[$c)/U/g"

Try it online!
Recognizes some invalid inputs that the other Perl entry does not.  Outputs the string unchanged if it is not valid.

05AB1E, 76 bytes
.•.Ÿ^91Ý•Ul„nuSKDXSKg0QVvXyk}JYP©0Êi®}¤«SXuèŒ2ùv…U NSy0èìžMuyåOè})Já¨¹d_iQ®P

Try it online!
Returns the falsy value 0 for invalid input.

Bash, 241 238  235 bytes
q=OIREASGTBP;[[ $1 == +([0-9]) ]]&&(x=`tr 0-9 $q<<<$1`;m={B,G,P,R,S,T};n={A,E,I,O};for i in `eval echo $m$m$n$n`;{ a=${i::1};b=${i:1:1};x=${x//$a$b/$a'U'$b};a=${i:2:1};b=${i:3:1};x=${x//$a$b/$a'N'$b};};echo $x)||tr $q 0-9<<<$1|tr -d UN

Try it online!
Less golfed:
q=OIREASGTBP;                          save string in q
[[ $1 == +([0-9]) ]]&&(                if argument 1 is only digits
x=`tr 0-9 $q<<<$1`;                    save in x each digit translated to corresponding letter
m={B,G,P,R,S,T};
n={A,E,I,O};
for i in `eval echo $m$m$n$n`;{        generates all combinations of vowels and consonants
                                       BBAA BBAE ... TTOI TTOO
   a=${i::1};                          saves first consonant in a
   b=${i:1:1};                         saves second consonant in b
   x=${x//$a$b/$a'U'$b};               insets U between consonants
   a=${i:2:1};                         saves first vowel in a
   b=${i:3:1};                         saves second vowel in b
   x=${x//$a$b/$a'N'$b};               inserts N between vowels
};
echo $x                               echoes result
)||                                   if argument contains letters
  tr $q 0-9<<<$1|tr -d UN             translates letter to corresponding number and deletes U and N

PHP, 268 Bytes
$v=OIEA;$l=RSGTBP;$d="0134256789";$c=ctype_digit;$p=preg_replace;echo!$c($a=$argn)?$c($e=strtr($p(["#\d|[$v]{2,}|[$l]{2,}#","#[$v]\KN(?=[$v])#","#[$l]\KU(?=[$l])#"],[_,"",""],$a),$v.$l,$d))?$e:_:$p(["#[$v](?=[$v])#","#[$l](?=[$l])#"],["$0N","$0U"],strtr($a,$d,$v.$l));

Try it online!

Ruby, 205+1 = 206 bytes
Uses the -p flag for +1 byte. Now with an exhaustive input validation system.
d,w=%w"0-9 OIREASGTBP"
~/^\d+$/?($_.tr!d,w
gsub /([#{a='AEIO])(?=\g<1>)'}/,'\0N'
gsub /([^#{a}/,'\0U'):(+~/^(([AEIO])(N(?=[AEIO])|(?=\g<4>)|$)|([RSGTBP])(U(?=\g<4>)|(?=\g<2>|$)))+$/;$_.tr!("NU","").tr!w,d)

Try it online!

This doesn't seem to convert letters to numbers, nor does it do any validation!

@Jarmex oops, added validation! It's a huge validation check but I don't have much choice in the matter

Perl, 127 bytes
126 bytes + 1  byte command line
$i="AEIOU]";$;=OIREASGTBP;1/!/[^$;NU\d]|[$i{2}|[^\d$i{2}/;eval"y/0-9$;NU/$;0-9/d";s/[$i\K(?=[$i)/N/g;s/[^N\d$i\K(?=[^\d$i)/U/g

Usage:
 echo -n "512431" | perl -p entry.pl

Should follow all the challenge rules - can accept letters or numbers and will error (division by zero) if validation fails

Validation has false positives on input NO and US.

Python 3, 741 bytes
from functools import reduce;c=0;e="";n="NU";v="AEIOU";l="OIREASGTBPNU";x=('0','O'),('1','I'),('2','R'),('3','E'),('4','A'),('5','S'),('6','G'),('7','T'),('8','B'),('9','P');s=input()
try:
    int(s);y=reduce(lambda a,kv:a.replace(*kv),x,s)
    for i in y:
        e+=i
        if i in v:
            z=True
            try:
                if y[c+1] in v:e+="N"
            except:
                pass
        else:
            z=False
            try:
                if not y[c+1] in v:e+="U"
            except:
                pass
        c+=1
except:
    for i in s:
        if not i in l:
            p
    y=reduce(lambda a,kv:a.replace(*kv[::-1]),x,s)
    for i in y:
        if not i in n:e+=i
print(e)

Try it online!
There's a lot of room for improvement, I know.

Python3, 246 bytes
v=lambda x:x in"AEIO"
V="OIREASGTBP"
i=input()
r=__import__("functools").reduce
print(r(lambda x,y:x+(("U",""),("","N"))[v(x[-1])][v(y)]+y,map(lambda x:V[x],map(int,i)))if i.isdigit()else r(lambda x,y:x*10+V.index(y),filter(lambda x:x in V,i),0))

explanation:

map input to a list of int
map list of int to their position in the alphabet
reduce list by adding accumulator, plus an element of a dicttuple, plus the current element

the dicttuple is a truth table based on two elements, being vowel or not

JavaScript (ES6), 120
A function taking input as a string. It returns the properly translated string if the input is valid, else false or the function crashes.
n=>(t=n=>n.replace(/./g,d=>1/d?(v-(v=d<5&d!=2)?'':'UN'[v])+z[d]:~(a=z.search(d))?a:'',v=2,z='OIREASGTBP'))(q=t(n))==n&&q

Less golfed
n =>
{
  var t = n => { // function to translate, no check for invalid input
    var v = 2; // 1 = digit map to vowel, 0 = digit map to consonant, start with 2
    var z = 'OIREASGTBP'; // digits mapping
    return n.replace(/./g,
      d => 1/d // digit / alpha check
        ? ( // if digit
            w = v, // save previous value of v
            v = d < 5 & d != 2, // check if current digit will map to wovel or consonant
            (w != v
             ? '' // if different - wovel+consonant or consonant+wovel or start of input
             : 'UN'[v] // if equal, insert required separator
            ) + z[d] // add digit translation
          )
        : ( // if alpha
             a = z.search(d), // look for original digit. Could crash if d is a reserved regexp char (not valid input)
             a != -1 ? a : '' // if digit found add to output, else do nothing
          )
    )
  }

  var q = t(n); // translate input an put in q
  if (t(q) == n) // translate again, result must be == to original input
    return q; // if ok return result
  else
    return false; // else return false
}

Test

var F=
n=>(t=n=>n.replace(/./g,d=>1/d?(v-(v=d<5&d!=2)?'':'UN'[v])+z[d]:~(a=z.search(d))?a:'',v=2,z='OIREASGTBP'))(q=t(n))==n&&q

;`512431 => SIRANENI
834677081 => BENAGUTUTOBI
3141592 => ENINANISUPUR
1234567890 => IRENASUGUTUBUPO
6164817 => GIGABIT`
.split('\n')
.forEach(x => {
  var [a,b] = x.match(/\w+/g)
  var ta = F(a)
  var tb = F(b)
  console.log(a==tb ? 'OK':'KO', a + ' => '+ ta)
  console.log(b==ta ? 'OK':'KO', b + ' => '+ tb)
})

function go() {
  O.textContent = F(I.value)
}

go()
<input id=I value='NUNS' oninput='go()'>
<pre id=O></pre>

APL (Dyalog Unicode), 71 bytes
' '~⍨,({' ',2{∧/x←'AEIOU'∊⍨⍺⍵:'N'⋄∧/~x:'U'⋄' '}/⍵},⍪)'OIREASGTBP'[⍎¨⍕⎕]

Try it online!
This turned out surprisingly short!
Uses ⎕IO←0 (0-indexing).
Explanation
' '~⍨,({' ',2{∧/x←'AEIOU'∊⍨⍺⍵:'N'⋄∧/~x:'U'⋄' '}/⍵},⍪)'OIREASGTBP'[⍎¨⍕⎕]
                                                                  ⍎¨⍕⎕  get the digits of the input
                                                     'OIREASGTBP'[    ] map to the correct letters
      {' ',2{∧/x←'AEIOU'∊⍨⍺⍵:'N'⋄∧/~x:'U'⋄' '}/⍵},⍪                     join the following with the tabled argument:
                                              /⍵                        map pairs of the argument to:
           2 ∧/x←'AEIOU'∊⍨⍺⍵:'N'                                        N if vowel pair,
                                ⋄∧/~x:'U'                               U if consonant pair,
                                         ⋄' '                           space otheriwse.
       ' ',                                                             prepend a space
    ,                                                                   flatten the result
' '~⍨                                                                   remove all spaces


text:
Golfception arrives
Lets play golf while we golf.
Problem:

Distance to the  hole initially is 700m
Each hit to the ball will make it advance to the hole 250-350m, this should be random.
Each hit has a 5% probabilities of going into water, this will make the quantity of hits increase by 1 as a penalty.
When ball is under 250m it will advance 70% to 90% (random again) of missing distance with a probability of 80%, Advance 90% to 99% with 14% Probability, 1% of doing 10%(and finishing) and 5% of going to water and increasing the number of hits by 1 as a penalty.
When ball is under 10m it has 95% of going into hole (finishing) and 5% of advancing 75% of the missing path. No probability of going water.

Clarifications:
-Imagine ball is 270m from hole, if we hit for 300m, the distance to the hole is now 30, this means, distance will be absolute value.
-Numbers will always be integer due to deal the probability of hitting for example 300m when ball is 300m away from the hole.
-Round down number of m of the hit, imagine you are at 1m , if you fall on 5% of not going into the hole, it will advance 0.
Input:
Nothing
Output:
Distance to the hole in each hit /n
Total number of hits
Example output (don't print comments)

433m //Hit for 267m (700-267=433)
130m //Hit for 303m (433-303=130)
130m //Ball on water +1 penalty hit
35m  //Hit for 95m (130-95=35)
7m   //Hit for 28m (35-28=7
0m   //Ball on hole
Total hits 7 //6 hits +1 penalty

This is codegolf!

Can you add a full work through example? If the ball goes in the water is the distance where it was when it was hit or where it should be if it wasn't in the water?

@TheLethalCoder if it goes to water the distance doesn't change, repeat the last hit

@NeilSlater the problem is that you don't know how many hits there will be so how many inputs?

Hey! Welcome to PPCG! In my opinion, this is a good first challenge! Good luck for future! :)

When the ball is under 10m, is there still a 5% chance the ball goes in the water?

Should the distance always be an integer?

@musicman523 Edited now to fill those questions :)

If distances are always integers, should resulting distance be rounded away from the hole (so there is only the 1% chance of actually hitting the hole? Or could a 90% shot at 2m distance also hit the hole? (I'm guessing the 10%(and finishing) should be 100%.

@Irn Round down number of m of the hit, imagine you are at 1m , if you fall on 5% of not going into the hole, it will advance 0.

The "random" 250-350 hit, should this be uniformly random?

@Irn, yes, if the random number generated from 0-100 is 55, the hit will be 305

As submissions have gone ahead as-is, I have removed my comments. There is no absolute need to alter your challenge IMO. I think there is a pre-challenge review process you can use to discuss design issues in future before inviting competitors.

@NeilSlater Thank you Neil :)

@NeilSlater That's the Sandbox.

I tried, but there are far too many percentage-based conditionals and RNG for this to really work in Braingolf.

Do we need to print the 'm' in the distances? Should we print 700m at the beginning?

Yes, m should be printed although it is not necessary to print the first distance (700m)

JavaScript, 204 198 bytes

P=console.log
r=x=>Math.random()*x
for(d=700,h=0;d;)x=r(100),D=d>=250?r(20)<1?h++*0:250+r(100):d*(d<10?x<5?.75:1:x<5?h++*0:x<6?1:.9+r(x<20?.09:-.2)),d=Math.abs(d-D|0),h++,P(d+'m')
P('Total hits '+h)

Less golfed:
r=x=>Math.random()*x
for(d=700,h=0;d;){
    x=r(100),
    D=
        d>=250
            ? r(20)<1
                ? h++*0
                : 250+r(100)
        : d * (d<10
            ? x<5
                ? .75
                : 1
        : x<5
            ? h++*0
        : x<6
            ? 1
        : .9 + r(
            x<20
                ? .09
                : -.2
            )
        ),
    d=Math.abs(d-D|0),
    h++,
    console.log(d+'m')
}

console.log('Total hits '+h)

Running your code, I got this output once. I don't think the distance can increase once you get within 250 meters, can you explain how your code meets the criteria of the problem?

@musicman523 It appears I added the percentage value to the distance rather than the percentage of the distance. I have now fixed it.

Python 3.6, 250 bytes
Saved 4 bytes thanks to isaacg, and 1 thanks to KoishoreRoy!
d=700                    # Current distance
from random import*
r=randrange              # Function that gets a random value in the range [0, input)
i=0                      # Number of strokes
while d:
 i+=1;x=r(20)<1          # x is False 95% of the time
                         # My justification for reusing this random value
                         # is that it's used once and only once, separate by if/elif
 if d<10:d-=[d,d*.75][x] # We're within putting range; goes in if x is true; otherwise makes 75% progress
 elif x:i+=1             # Goes in the water, add a stroke
 elif d<250:
  s=r(95);d-=[d,d*[.7+r(21)/100,.9*r(10)/100][s<15]][s>0]
                         # Only 95 because we already checked to see if it would go in the water
                         # 99% of the time (s>0), it doesn't go in
                         # 14% of the time (s<15), it makes 90-99% progress
                         # Otherwise, it makes 70-90% progress
 else:d-=250+r(101)      # Lose 250-350 yards
 d=int(abs(d));print(f'{d}m')
print(f'Total hits {i}')

Try it online! (Uses Python 3.5 printing syntax at a cost of 6 bytes since TIO does not yet support Python 3.6.)

You are missing the number of hits (remember the ball can go water and add a hit)

Updated and golfed slightly further!

Where do you add the penalty hit for going to water?

Fixed a couple issues and golfed slightly further. The penalty for going in the water happens with elif r(0,19)<1:0; this cases the current iteration to do nothing 5% of the time.

It has to do something, adding 1 more hit as penalty

It does - every iteration prints the current distance and increments the number of hits. That line makes it so d doesn't change in the current iteration.

I mean, apart from the missed hit, there is another hit adittion for loosing the ball

Oh, gotcha! Fixed it, costing just 3 bytes. I do think this can still be golfed further, though.

You can use semicolons to combine indented lines without statements into one line, which shortens it. For instance, i+=1;x=r(20)<1 works.

is it just me or the two code doesn't work?

@KoishoreRoy You're right, it doesn't. I can't seem to figure out why. It definitely worked before I started using semicolons, but taking them out doesn't seem to help. Any thoughts?

it's flagging an error in the last end. I tried replacing all the spaces with tabs and that didn't help me figure out anything either.
Also, unrelated to the running of the code, you can save a few bytes by using from random import randrange as r

I totally forgot you can do that in Python. Thanks! As for the syntax error...I'll try and figure it out.

My bad. What I said earlier actually increases 1 byte!
Use from random import*;r=randrange instead. That reduces 1 byte.

Found the error - stray brace. Also thanks for the byte! I like being at an even 250 ☺

Perl 6, 212 bytes
my&p=(^*).pick;say 'Total hits ',(700,->\d{my \n=d>249??abs d-(p(20)??250+p
100!!0)!!d>9??d-(|((d*(70+p 21)div 100) xx 80),|((d*(90+p 10)div 100) xx
14),d,|(0 xx 5))[p 100]!!p(20)??d div 4!!0;"{n}m".say;n}...0)-1

&p is a helper function that picks a random number from 0 to one less than its argument.  The expression after 'Total hits ' is a lazily-constructed list that generates each element based on the previous element.  The elements are printed as they are generated, which isn't very functional, but it is shorter than storing them in an intermediate array.

source: Stack Exchange

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

sort: votes


text:
Find Subset Factors
Let's imagine we have a finite set of positive integers.  This set can be represented as a line of dots where each integer present in the set is filled in like a scantron or punch card.  For example the set {1,3,4,6} could be represented as:
*.**.*

* represents a member of our set and . represents an integer that is not a member oft he set.
These sets have "factors". Loosely x is a factor of y if y can be built out of copies of x.  More rigorously our definition of factor is as follows:

x is a factor of y if and only if y is the union of a number of disjoint sets, all of which are x with an offset.

We would call *.* a factor of *.**.* because it is quite clearly made up of two  copies of *.* put end to end.
*.**.*
------
*.*...
...*.*

Factors don't have to be end to end, we would also say that *.* is a factor of *.*.*.*
*.*.*.*
-------
*.*....
....*.*

Factors can also overlap.  This means *.* is also a factor of ****
****
----
*.*.
.*.*

However a number cannot be covered by a factor more than once.  For example *.* is not a factor of *.*.*.

Here is a more complicated example:
 *..*.**..***.*.*

This has *..*.* as a factor.  You can see that below where I have lined up the three instances of *..*.*.
*..*.**..***.*.*
----------------
*..*.*..........
......*..*.*....
..........*..*.*

Task
Given a set by any reasonable representation output all the sets that are factors of the input.
You may index by any value, (that is you may select a smallest number that can be present in the input).  You may also assume that the input set will always contain that smallest value.
This is a code-golf question so you should aim to do this in as few bytes as possible.
Test Cases
These test cases were done by hand, there may be a mistake or two on the larger ones
*                -> *
*.*.*            -> *, *.*.*
*.*.*.*          -> *, *.*, *...*, *.*.*.*
******           -> *, **, *..*, ***, *.*.*, ******
*..*.**..***.*.* -> *, *..*.*, *.....*...*, *..*.**..***.*.*
*...*****.**.**  -> *, *...**.**, *.....*, *...*****.**.**

If we take the set as a list of numbers (e.g. [1,3,5,7] for *.*.*.*) can we assume that it's sorted?

@MartinEnder Yes.  I forgot to add but you can also always assume it contains 1 if you wish.

Is this equivalent to finding divisors of polynomials whose coefficients are restricted to 0 and 1?

@xnor I'm not sure. If *.*.* = x+x^2+x^4, then 1+x+x^2 = *** would be a divisor, right? x+x^2+x^4 = (1-x+x^2)(1+x+x^2)

If *...* is a factor of *.*.*.* why is *. not a factor too? (also of *.*.*, and why is *.. not; etc?) EDIT: because they cant overflow the end?

@JonathanAllan For your examples, * is listed as a factor which represents the same subset as *. or *...

@MartinEnder It does not say that anywhere, but it makes sense (in fact it says "output all").

@mbomb007 Good point, the lack of negative coefficients makes a difference.

Can our input set be "0-indexed", having 0 instead of 1?

@JonathanAllan It says output all sets, not output all ASCII representations of the valid sets.

Mathematica, 71 68 bytes
#&@@@Cases[(s=Subsets)@s@#,x_/;Sort[Join@@x]==#&&Equal@@(#&@@@x-x)]&

Input as {1,3,5,7} (sorted) and output as {{1, 3, 5, 7}, {1, 3}, {1, 5}, {1}}. The function will throw a bunch of messages.
This is O(22Nope) (where N is the length of the input and o=p=e=1...). It generates all subsets of subsets, then selects those that result in the input send when joined together (ensuring we're only considering partitions) and where all elements are the same if we subtract the smallest value of each subset).

Jelly, 12 bytes
;÷@DỊȦ
ÆDçÐf

Input and output use 1 and 0 instead of * and ..
Try it online!
How it works
ÆDçÐf   Main link. Argument: n (integer with decimal digits 1 and 0)

ÆD      Compute all divisors of n.
  çÐf   Filter; call the helper link with left argument d and right argument n for
        all divisors d of n. Return the array of d's for which the helper link
        returns a truthy value.

;÷@DỊȦ  Helper link. Left argument: d. Right argument: n

 ÷@     Divide n by d.
;       Concatenate, yielding [d, n÷d].
   D    Decimal; convert both integers in the pair to base 10.
    Ị   Insignificant; map 1 and 0 to 1, all other positive integers to 0.
     Ȧ  All; return 1 iff the result contains no zeroes.

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


text:
Help me golf my numbers!
When writing code-golf programs, I usually end up using some numeric constants. I always put them in decimal because that's how I think, but I just realized that my language supports other number formats that might let me shorten my code slightly.
Challenge
Given a non-negative integer less than 2^53-1, decide whether that integer has the shortest representation in:

Decimal
Hexadecimal
Scientific Notation

Decimal
Since this is the default format of my language, there is no extra notation needed for this format. Every number is represented as usual for decimal.
Hexadecimal
My languages uses the 0x prefix for hexadecimal constants. This means that if a number has 4 hexadecimal digits, it will take 6 bytes to represent that number.
Scientific notation
My language uses the following format for scientific notation:

[Real base]e[Integer exponent of 10]

For example, 700 would be represented as 7e3, and 699 would be represented as 6.99e3, because the base must be between -10 and 10 (non-inclusive). For the purposes of this challenge, the base will always be at least 0, since the inputted number is non-negative.
Output
You should return a way of identifying which format is shortest (i.e. 0 for decimal, 1 for hex, 2 for scientific). Alternatively, you may output the smallest representation of the number itself.
Test cases
Decimal       | Hexadecimal  | Scientific        | Winner
--------------|--------------|-------------------|-------------
0             | 0x0          | 0e0               | Decimal
15            | 0xF          | 1.5e1             | Decimal
6999          | 0x1B57       | 6.999e3           | Decimal
7000          | 0x1B58       | 7e3               | Scientific
1000000000000 | 0xE8D4A51000 | 1e12              | Scientific
1000000000001 | 0xE8D4A51001 | 1.000000000001e12 | Hexadecimal
1000000001000 | 0xE8D4A513E8 | 1.000000001e12    | Hexadecimal
1000001000000 | 0xE8D4B45240 | 1.000001e12       | Scientific

Scoring
This is code-golf, so the answer in the shortest bytes for each language wins.

Relevant

The requirement to go up to 2^63-1 may be difficult for some languages. Consider relaxing that to a lower value such as 2^32-1 (so the values fit in a double floating point data type)

To clarify: we can either output all 3 reprsentations of the number or the name of the single representation that uses the least amount of characters?

@LuisMendo Unfortunately hex never wins below 2^32, which is why I made this requirement

I see. How about 2^52-1? That still fits in double. Just a suggestion; do as you see fit

@Shaggy you should either:

Decide upon three unique results for the winning format, such as 0 for decimal, 1 for hex, and 2 for scientific, and always output those (see this meta question, but instead of Truthy/Falsey, you should choose 3 distinct outputs), or
Output the best representation of the integer

@LuisMendo Updated. My original intent was for C/C++/Java users to use long (and Scala to use Long), but if it's easier to use doubles then go for it

Gotcha! Thanks for clearing that up. Can we take input as a string?

I think the limit for double is 2^53-1, so you could still increase by a factor of 2

@Shaggy I'm not sure, I can't find a consensus on that issue. If you can find one in the codegolf meta, could you link it here? Otherwise for now, just leave a footnote on your answer showing how it can be shortened with the alternative input format

@LuisMendo Thanks, updated

1000001000000 can also be written as 1000001e6 though.

@EriktheOutgolfer AFAIK most languages don't use scientific notation like that

@EriktheOutgolfer Sorry, I should have specified more clearly - this challenge uses the standard form for scientific notation

@StephenS Output from repr-like functions won't be like that but you can perfectly write that as a literal.

@musicman523 ooh that's actually quite challenging

If two notations tie (e.g. hex & dec for 10000000001) may we output just one? May we output both?

You may do either

...and may we output a list of identifiers in order?

@JonathanAllan yes, that was @ you, sorry. And no, you may not output the ordered list; since this is a [tag:decision-problem], you need to decide on one single output. (But your implementation may sort the list and output the first item.)

Annoyingly in C# ulong.ToString("e"), converting to scientific notation, loses precision on the larger numbers. So I'm going to have to do that conversion manually.

Isn't a [tag:decision-problem] by definition only supposed to have two possible outputs?

It looks like, according to this meta post, it should be a [tag:classification] problem. I'll make this change.

I'm sandboxing Part 2 now, if anyone would like to help!

05AB1E, 23 bytes
hgÌ¹gD<g>¹ÀðìÁ0ÜðÜg+)Wk

Try it online!
-1 thanks to Emigna.
0 for hexadecimal, 1 for decimal, 2 for scientific.

Save a byte with '.ìÁ0.

@Emigna ooh that prepend always golfs stuff.

05AB1E, 27 bytes
Dg<¹À'.ìÁ0Ü'.Ü…ÿeÿIh…0xÿ)é¬

Try it online!
Explanation
D                            # duplicate input, one copy will be used as decimal notation
 g<                          # len(input)-1
   ¹À                        # push input and rotate left
     '.ìÁ                    # prepend a dot and rotate right
         0Ü'.Ü               # remove trailing zeroes and then any trailing dot
              …ÿeÿ           # format scientific notation
                  Ih         # input converted to hex
                    …0xÿ     # format hex
                        )    # wrap in a list
                         é   # sort by length
                          ¬  # get the first (shortest) item

Ew, there should be something shorter here.

@EriktheOutgolfer: Probably. I spend a lot of bytes with the scientific notation. It would probably be shorter to not create the actual values and only check the lengths instead.

Hex length is len(hex(input)) + 2, if that helps.

@EriktheOutgolfer: Yeah, 5 bytes to get lengths of hex and decimal. It's the scientific notation that will cost bytes. Will likely beat this though.

Sure? It seems like 6 to me (DhgÌsg).

@EriktheOutgolfer: Using ¹ instead of Ds: g¹hgÌ

Let us continue this discussion in chat.

Jelly, 28 bytes
TṀµỊ¬+‘
DµL’DL+Ç,L
b⁴L+2;ÇỤḢ

A monadic link returning 1, 2, or 3 for hexadecimal, scientific, or decimal respectively.
Try it online! or see a test suite.
I thought this would be shorter, but I can't see it so am posting.
How this monstrosity works...
TṀµỊ¬+‘    - Link 1, length of mantissa + "e": list of decimal digits  e.g. [7,0,1,0]
T          - truthy indexes                                                 [1,  3  ]
 Ṁ         - maximum                                                             3
  µ        - monadic chain separation, call that m
   Ị       - insignificant? (abs(m)<=1) -- here: 1 for m=1, 0 otherwise          0
    ¬      - logical not                  i.e. 1 if a "." will be used           1
     +     - add m                                                               4
      ‘    - increment                    always uses an 'e'                     5

DµL’DL+Ç,L - Link 2, lengths of scientific and decimal notations: non-negative-integer, n
D          - cast to decimal list
 µ         - monadic chain separation, call that d
  L        - length of d (number of decimal digits of n)
   ’       - decrement (value of exponent)
    D      - cast to decimal list (exponent's digits)
     L     - length (number of characters in the exponent)
       Ç   - call last link (1) as a monad(d) (number of characters in mantissa + "e")
         L - length of d (number of decimal digits of n)
        ,  - pair

b⁴L+2;ÇỤḢ - Main link: non-negative-integer, n
 ⁴        - literal 16
b         - convert n to base 16
  L       - length (number of hexadecimal digits)
   +2     - add two (number of characters including the "0x")
      Ç   - call the last link (2) as a monad (characters in scientific and decimal)
     ;    - concatenate ([charsInHexadecimal, charsInScientific, charsInDecimal])
       Ụ  - sort indexes by value
        Ḣ - head (1-based-index in the above list of (one of) the shortest)

28 bytes!? Might as well use C#... :P

@TheLethalCoder Definitely a deceptive challenge - there must be a GL out there that can just format numbers to the scientific notation!

@TheLethalCoder There's a 75 byte Jelly answer posted on another question not that long ago. Can't remember what one. Ah it was this one, but this one is 83.

@Draco18s both mine I see! The comment made me look at this one which was standing at 91 from 8 months ago; I golfed it down to 85 :)

I had to le google the phrase "longest Jelly" restricted to codegolf.stackexchange.com in order to find them. :P There was a third, but it was only a paltry 57 bytes....Also yours.

Ah well then there is code-bowling 15,410 cracking Dennis's 25,394.

JavaScript (ES6), 90 bytes
Returns 0 for decimal, 1 for hexadecimal, -1 for scientific.
n=>(l=Math.log,D=l(n)/l(10),H=l(n)/l(16)+2,S=n.toExponential().length-1,S<H?-(S<D):+(H<D))

f=
n=>(l=Math.log,D=l(n)/l(10),H=l(n)/l(16)+2,S=n.toExponential().length-1,S<H?-(S<D):+(H<D))

console.log(
    f(0),
    f(15),
    f(6999),
    f(7000),
    f(1000000000000),
    f(1000000000001),
    f(1000000001000),
    f(1000001000000)
)

Explanation

log(n) / log(10): base-10 logarithm of n; roughly the length of n as a decimal.
log(n) / log(16) + 2: base-16 logarithm of n plus 2; roughly the length of n as a hexadecimal plus the prepended 0x.
n.toExponential().length - 1: n.toExponential() returns a string with n in scientific format (e.g. 7e+3) but we subtract 1 from its length to account for the extraneous +.

Now that we have the lengths of all 3 representations D, H, andS, we compare:S<H?-(S<D):+(H<D)

JavaScript (ES6), 97 bytes
This one outputs the number in the format with the shortest length. Inspired by @Shaggy's deleted attempt.
n=>[n+'','0x'+n.toString(16),n.toExponential().replace('+','')].sort((x,y)=>x.length-y.length)[0]

f=
n=>[n+'','0x'+n.toString(16),n.toExponential().replace('+','')].sort((x,y)=>x.length-y.length)[0]

console.log(
    f(0),
    f(15),
    f(6999),
    f(7000),
    f(1000000000000),
    f(1000000000001),
    f(1000000001000),
    f(1000001000000)
)

Nice :) I wonder could you pillage anything from my abandoned attempt at a solution to golf this down further? You'll find it in the deleted posts at the end of the page.

@Shaggy Yours is fundamentally different since it outputs the formatted number. I added a separate answer based off of it instead. :)

C#, 106 97 96 143 132 bytes
using System.Linq;n=>new[]{n+"",$"0x{n:X}",(n+"").Insert(1,".").TrimEnd('0','.')+"e"+((n+"").Length-1)}.OrderBy(s=>s.Length).First()

Annoyingly in C# the ulong.ToString format specifier e loses precision on the higher numbers so I've had to do it manually. There's probably a shorter way to do it but this works for now. It also formats it incorrectly for this challenge so I would have to manually strip it's output anyway.
If I set a string to the value of n as var s=n+""; it works out longer because of the explicit return and extra curly braces.
It returns the shortest value from the array of each different value where [0] = decimal, [1] = hexadecimal, [2] = scientific.
Full/Formatted version:
using System.Linq;
Func<ulong, string> f = n =>
    new[]
    {
        n + "",
        $"0x{n:X}",
        (n + "").Insert(1, ".").TrimEnd('0', '.') + "e" + ((n + "").Length - 1)
    }.OrderBy(s => s.Length).First();

The correct way to calculate the scientific output is:
(n < 1 ? n + "" : (n + "").Insert(1, ".").TrimEnd('0', '.')) + "e" + ((n + "").Length - 1)

However, seeing as 0 is shorter than 0e0 I can remove that special case.

Python 2, 83 77 bytes
Outputs the smallest representation of the number.
import re
lambda n:min(`n`,hex(n),re.sub('\.?0*e\+0?','e','%.15e'%n),key=len)

Try it online
Ungolfed:
import re
n=input()
d=`n`
h=hex(n)
s=re.sub('(.)\.?0*e\+0?',r'\1e','%.15e'%n)
print min(d,h,s,key=len)

The regex removes trailing zeros and the decimal point if necessary, as well as the plus sign and leading zero from the exponent if there is one.

I think the backticks will append an L to large numbers within the input range. str would avoid that.

@xnor The maximum integer we have to support is within Python's int representation. Longs start at roughly 2**63.

Do you need to do the regex subbing? Can you just remove + characters with str.replace?

@musicman523 That'd be a lot longer. The regex subbing needs to be done anyway for removing the zeros and decimal point, and it's only 2 bytes to remove the + while I'm at it.

Ohm, 35 bytes
l┼xl2+┼DRîsRl≥al≤Dla°┼îa/ì\?≥;+WD╤k

Try it online!
Outputs 0 for decimal, 1 for hex and 2 for scientific.
Explanation:
l                                      Implicit input, get length
 ┼                                     Input again
  x                                    To hex
   l                                   Get length
    2+                                 Add 2 because of "0x"
      ┼                                Get input again
       D                               Duplicate on the stack
        RîsR                           Remove zeroes at the end (reverse, to int, to string, reverse)
            l                          Get length (= length of base)
             ≥                         Add 1 because to count "e" in the scientific notation
              a                        Swap top two values on the stack
               l≤                      Get length - 1 ( = get the exponent of 10 in scientific notation)
                 D                     Duplicate on the stack
                  l                    Get length ( = length of the exponent)
                   a                   Swap. Now on top of the stack we have the exponent again
                    °                  10^exponent
                     ┼î                Get input for the fourth time
                       a/              Divide input by the 10^exp calculated earlier
                         ì\?           If this thing is not an integer...
                            ≥;         ...add one to count the "."
                              +        Sum base length ( + "e") + exponent length ( + ".")
                               W       Wrap stack in array
                                D      Duplicate
                                 ╤k    Get index of min value

C, 187185 bytes
main(){long long N;scanf("%lli",&N);long long D=log10(N)+1,H=log(N)/log(16)+3,F,S,i=1;while(N>i&&!(N%i))i*=10,F++;S=ceil(log10(D-1))+1+D-F+(D-F>1);printf("%i",N?H>D?2*(D>S):1+(H>S):N);}

Decompressed:
void main(){
    long long N;
    scans("%lli", &N);
    long long D = log10(N) + 1; // Length of number (decimal)
    long long H = log(N)/log(16) + 3; // Length of number (hexadecimal)
    long long F; // Number of 0s at the end of decimal number
    long long S; // Length of number (scientific notation)
    long long i; // Counter (more or less)
    // Get number of zeros at the end of decimal number
    while(N > i && (N % i) == 0){
        i = i * 10;
        F++;
    }
    S = ceil(log10(D - 1)) + 1 + D - F + (D-F>1); // (Power) + (e) + (multiplier + (1 if len(multiplier) > 1))
    printf("%i", N!=0 ?
                (H > D ? 2 * (D > S) : 1 + (H > S))
              : 0); // Print the shortest number
}

Prints 0 for decimal, 1 for hex, 2 for scientific notation.

PHP, 90 bytes
prints 0 for decimal, 1 for hexadecimal and 2 for scientific
in case of a tie the highest number will be print

<?=array_flip($m=[$l=log10($a=$argn)^0,2+(log($a,16)^0),strlen(($a/10**$l).$l)])[min($m)];

Try it online!
PHP, 91 bytes
prints 0 for decimal, 1 for hexadecimal and 2 for scientific
in case of a tie the lowest number will be print

<?=array_search(min($m=[$l=log10($a=$argn)^0,2+(log($a,16)^0),strlen(($a/10**$l).$l)]),$m);

Try it online!
PHP, 103 bytes
prints 0 for decimal, 1 for hexadecimal and 2 for scientific
in case of a tie all numbers will be print

foreach($m=[$l=log10($a=$argn)^0,2+(log($a,16)^0),strlen(($a/10**$l).$l)]as$k=>$v)echo$v-min($m)?"":$k;

Try it online!
PHP, 109 bytes
Output an array with the shortest solutions

for(;!$p=preg_grep("#^.{".++$i."}$#",[$a=$argn,"0x".dechex($a),$a/10**($l=log10($a)^0)."e$l"]););print_r($p);

Try it online!

TI-Basic, 130 bytes
Input N:If not(N:Goto 0:1+int(log(N→D:3+int(logBASE(N,16→H:0→F:1→I:While N>I and not(fPart(N/I:10I→I:F+1→F:End:log(D-1→L:1+D-F+(D-F>1):Ans+int(L)+(0≠fPart(L→S:(H>D)2(D>S)+(H≤D)(1+(H>S)→N:Lbl 0:N

Or, alternatively:
�N>θN>�0>1p��ND>3p�������BASEN+16H>0F>1I>�NlI@��N�I>10II>Fp1F>�>�Dq1L>1pDqFpDqFl1>rp�Lp0o�LS>HlD2DlSpHmD1pHlSN>�0>N

Or, in hex:
dc4e3eceb84e3ed7303e3170b1c04e04443e3370b1bbbcbbbfbbb642415345104e2b313604483e3004463e3104493ed14e6c4940b8ba4e83493e31304904493e46703104463ed43ec0447131044c3e317044714670104471466c31113e7270b14c117010306fba4c04533e10486c44113210446c53117010486d441110317010486c5311044e3ed6303e4e

Prints 0 for decimal, 1 for hex, 2 for scientific notation


text:
Interpret the interpreted
Task
You must write a program in Language A that will output the source code for a program in Language B which will then output the source code for a program in Language C and so on and so forth. The final program must output the x root y where x and y are the inputs e.g. in Python:
print(int(input()) ** (1/int(input())))

Your score is L / N where L is the total length of all your programs and N is the number of languages.
N must be greater or equal to 3 to allow for a proper challenge.
Different versions don't count as different languages
As usual, lowest score wins.
Example submission
# C++/brainfuck/Python, 223 points

## C++

    #include <iostream>

    int main() {
      printf("+[------->++<]>++.++.---------.+++++.++++++.+[--->+<]>+.-----[->+++<]>.+++++.++++++.+[--->+<]>+.-----[->+++<]>.+++++.++.+++++.-.+[--->+<]>+.+..---------.++++++++++..----------.++++++++.+++++++++.--.[--->+<]>++++.+++++.++++++.+[--->+<]>+.-----[->+++<]>.+++++.++.+++++.-.+[--->+<]>+.+....");
    }

## brainfuck

    +[------->++<]>++.++.---------.+++++.++++++.+[--->+<]>+.-----[->+++<]>.+++++.++++++.+[--->+<]>+.-----[->+++<]>.+++++.++.+++++.-.+[--->+<]>+.+..---------.++++++++++..----------.++++++++.+++++++++.--.[--->+<]>++++.+++++.++++++.+[--->+<]>+.-----[->+++<]>.+++++.++.+++++.-.+[--->+<]>+.+....

## Python

    print(int(input()) ** (1/int(input())))

You don't have [tag:code-golf]. You have [tag:code-challenge].

@EriktheOutgolfer yes. Why shouldn't I?

@Ilikemydog Wait I just re-read the scoring criterion. nvm

05AB1E/GolfScript/Jelly 11 6 bytes / 3 languages = 2
"'İ*@'

Both 05AB1E and GolfScript have the nice property that they do implicit prints of strings, so we only lose 3 bytes on them (because 05AB1E doesn't need the closing quote).
Also, my first 05AB1E, GolfScript, and Jelly programs.

Make that lua program a string literal, wrap it in an alert() and call it JavaScript for a 4th stack. You could then string literal that and put echo in front and call it php.

@Draco18s Working on a better replacement

You can golf the Jelly program to İ*@.

And it may be possible to use the Jelly code page for all of them, since the important stuff for the first two are the quotes, which will be the same bytes as they're in the normal ASCII range

@BusinessCat Indeed — thanks for the help

with charcoal->SOGL->05AB1E->GolfScript->Jelly and code ""'İ*@' score is 7/5 = 1.5

I can get the score arbitrarily close to 1 by adding HTML, PHP, and so on.


text:
Decrypt xor-encryption
Your task is to take an encrypted string as input, and output the string decrypted, to reveal its hidden message.
The strings, both the input and output, will contain characters from this list of 64 ASCII-characters (note the leading space):
 !"#$%&'()*+,-./0123456789:;=?@[\]^_abcdefghijklmnopqrstuvwxyz|~

These characters are assigned numbers, in the order they are listed above:
  ! " # $ % &   ...
0 1 2 3 4 5 6   ...

So, space is number 0, ! is number 1 and ~ is number 63. These numbers can be represented in 6-bit binary code:
 :  0:  000000
!:  1:  000001
":  2:  000010
#:  3:  000011
.. ...  ......
z: 61:  111101
|: 62:  111110
~: 63:  111111

The encryption is very simple:
I'll use eC for encrypted characters, and C for characters of the original string. C(n) is the n'th character of the original string, while eC(n) is the n'th character of the encrypted string.
You'll use the 6-bit binary representation of the characters. The first character will be eC(0) = not(C(0)). From there, all characters will be eC(n) = xor(C(n),C(n-1)).
Example:
Let's assume the input string is code.

c is the 38th character (zero indexed), or 100110 in binary. The encrypted version has all bits flipped, so 011001 -> 25 -> '9' (again, zero indexed).
o is the 50th character, or 110010 in binary. xor(100110, 110010) = 010100 = 20 = '4'.
d is the 39th character, or 100111 in binary. xor(100111, 110010) = 010101 = 21 = '5'.
e is the 40th character, or 101000 in binary. xor(101000, 100111) = 001111 = 15 = '/'.

So, if the original string is code, the encrypted string will become 945/.

Test cases:
945/
code

,&'8[14 =?;gp+% 2'@s&&c45/eg8?&
programming puzzles & code golf

;a$5$%0r?2@12dw6# lb-eg&519nt%ot=9$@es@96+?;ga" 4*)&ta56dp[?o#t%oh/"(&?#ee![,+,/+fe4"
a $150 reward will be given to those sending account and pin# to hackers@steal_id.com

~!#!'!#!/!#!'!#![!#!'!#!/!#!'!#!~!#!'!#!/!#!'!#![!#!'!#!/!#!'!#!
 !"#$%&'()*+,-./0123456789:;=?@[\]^_abcdefghijklmnopqrstuvwxyz|~

Married life and already with the decoding of messages? :p

@JonathanAllan I've been decoding messages for years... :P

Jelly, 27 26 bytes
ØJḟ“<>`{}”ḟØAɓi@€_33^\96_ị

Try it online!
Alternate version, 22 bytes (non-competing)
Jelly finally caught up with other golfing langs and got a printable ASCII atom, so this works now.
ØṖḟ“<>`{}”ḟØAɓi@€’^\Nị

Try it online!
How it works
ØJḟ“<>`{}”ḟØAɓi@€_33^\96_ị  Main link. Argument: s (string)

ØJ                          Yield Jelly's code page, i.e., 32 non-ASCII characters,
                            followed by all printable ASCII characters, followed by
                            129 non-ASCII characters.
  ḟ“<>`{}”                  Filterfalse; remove the characters "<>`{}".
          ḟØA               Filterfalse; remove all uppercase ASCII letters.
                            Let's call the resulting alphabet a.
             ɓ              Begin a new, dyadic chain.
                            Left argument: s. Right argument: a
              i@€           Find the (1-based) index of all characters of s in a.
                 _33        Subtract 33, so ' ' maps to 0, '~' maps to 63.
                    ^\      Compute the cumulative bitwise XOR.
                            We didn't take the bitwise NOT of the first index,
                            which can be rectified by subtracting all results from
                            63. However, we must also add 33 to account for the
                            fact that the index of ' ' in a is 33.
                      96_   Subtract the results from 96.
                         ị  Index into a.

Ugh I thought of this within the last couple of minutes! Shame on me for posting an explanation first :p

JavaScript (ES6), 115 bytes
s=>s.replace(/./g,s=>d[x^=d.indexOf(s)],x=63,d=` !"#$%&'()*+,-./0123456789:;=?@[\\]^_abcdefghijklmnopqrstuvwxyz|~`)

Test cases

let f =

s=>s.replace(/./g,s=>d[x^=d.indexOf(s)],x=63,d=` !"#$%&'()*+,-./0123456789:;=?@[\\]^_abcdefghijklmnopqrstuvwxyz|~`)

console.log(f("945/"))
console.log(f(",&'8[14 =?;gp+% 2'@s&&c45/eg8?&"))
console.log(f(';a$5$%0r?2@12dw6# lb-eg&519nt%ot=9$@es@96+?;ga" 4*)&ta56dp[?o#t%oh/"(&?#ee![,+,/+fe4"'))
console.log(f("~!#!'!#!/!#!'!#![!#!'!#!/!#!'!#!~!#!'!#!/!#!'!#![!#!'!#!/!#!'!#!"))

I think the ^ goes to the right of the ]. The answer still works with that change for the test cases I believe.

Might it be shorter to construct d from what is missing?

@JonathanAllan Maybe, but JS has pretty long character manipulation methods. I failed to have a dynamic version shorter than a simple hardcoded string in previous similar challenges and also had no success this time so far.

I know this is javascript but it doesn't look like it at all :S

Jelly,  34  31 bytes
-3 bytes thanks to Dennis (use ḟ twice rather than œ-, ; and ¤; use ”~ rather than 63 )
32r126Ọḟ“<>`{}”ḟØAṙ1ɓ”~;i@€^\Ḋị

A monadic link taking and returning lists of characters.
*Note: the input arguments to a Jelly program utilise Python string formatting, so quoting with ", ', ''' (or if unambiguous no quoting) are all options.
Try it online!
How?
Bitwise-xor is invertible (given "leading zeros").
Bitwise-Not is an xor with "all ones" - in this case only 6 ones are ever required, so 27-1 = 63.
Once we have created the array or characters and looked up the indexes of the input characters, the decode itself is then simply a cumulative reduction by bitwise-xor, after which we may index back into the same array.
32r126Ọḟ“<>`{}”ḟØAṙ1ɓ”~;i@€^\Ḋị - Main link: string, s
32r126                          - inclusive range -> [32,33,...,125,126]
      Ọ                         - cast to ordinals -> " !...}~"
        “<>`{}”                 - literal ['<','>','`','{','}']
       ḟ                        - filter discard
                ØA              - yield "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
               ḟ                - filter discard
                  ṙ1            - rotate left by one (Jelly indexing is one based)
                    ɓ           - dyadic chain separation, swapping arguments (call that p)
                     ”~         - literal '~'
                       ;        - concatenate with s (`~` has value 63 for the bitwise-not)
                        i@€     - first index* of €ach character of s in p
                            \   - cumulative reduce by:
                           ^    -   bitwise-xor
                             Ḋ  - dequeue (remove the 63 from '~')
                              ị - index into p

* Note: looking up a space in p will yield a 64, but that's OK since indexing back into p is modular so adding a leading 1 is like adding 64, taking the index right back around to where it needs to be).

Java, 225 bytes
String D(String E){String A="",C=" !\"#$%&'()*+,-./0123456789:;=?@[\\]^_abcdefghijklmnopqrstuvwxyz|~";for(int i=-1,J=0;++i<E.length();J=C.indexOf(E.charAt(i)),A+=C.charAt(i<1?(1<<6)-1-J:C.indexOf(A.charAt(i-1))^J));return A;}

I have not golfed in Java in a very long time, so any golfing tips are appreciated.
Try It Online!

I know it's been a while, but some things to golf: using a Java 8+ lambda, so String D(String E){ becomes E->{ (-15 bytes); -1-J can be +~J (-1 byte); and i=-1 can be i=0, the ++ can be moved to i++<1?, and then the i-1 becomes i-2 (-1 byte). Try it online: 208 bytes

05AB1E, 40 bytes
'~«vžQAu"<>{}`"«SK©yk64+b¦S}r.gG^DJC®sè?

Try it online!
Explanation
'~«                                       # append input to "~"
   v                                      # for each char y in the resulting string
    žQ                                    # push printable ascii chars
      Au                                  # push upper case alphabet
        "<>{}`"«                          # append "<>{}`"
                SK                        # remove those chars from printable ascii
                  ©                       # store a copy in register
                   yk                     # get the index of y in that string
                     64+                  # add 64
                        b                 # convert to binary
                         ¦S               # remove leading 1 and convert to list of bits
                           }              # end loop
                            r             # reverse stack
                             .gG          # len(stack)-1 times do
                                ^         # xor top 2 lists of bits on the stack
                                 DJC      # convert a copy to decimal
                                    ®sè   # index into the char string with this
                                       ?  # print

C (gcc), 153 bytes
char*i=" !\"#$%&'()*+,-./0123456789:;=?@[\\]^_abcdefghijklmnopqrstuvwxyz|~";a(b){b=index(i,b)-i;}f(char*x){for(*x=i[a(*x)^63];x[1];)*x=i[a(*x)^a(*++x)];}

Try it online!
Slightly golfed less
char*i=" !\"#$%&'()*+,-./0123456789:;=?@[\\]^_abcdefghijklmnopqrstuvwxyz|~";
a(b){
  b=index(i,b)-i;
}
f(char*x){
  for(*x=i[a(*x)^63];x[1];)
    *x=i[a(*x)^a(*++x)];
}

CPU x86 instruction set, 235 bytes
00000750  50                push eax
00000751  8A10              mov dl,[eax]
00000753  80FA00            cmp dl,0x0
00000756  7418              jz 0x770
00000758  31DB              xor ebx,ebx
0000075A  EB03              jmp short 0x75f
0000075C  F9                stc
0000075D  EB13              jmp short 0x772
0000075F  8A83C1A14000      mov al,[ebx+0x40a1c1]
00000765  3C00              cmp al,0x0
00000767  74F3              jz 0x75c
00000769  38C2              cmp dl,al
0000076B  7404              jz 0x771
0000076D  43                inc ebx
0000076E  EBEF              jmp short 0x75f
00000770  42                inc edx
00000771  F8                clc
00000772  58                pop eax
00000773  C3                ret
00000774  53                push ebx
00000775  8B442408          mov eax,[esp+0x8]
00000779  31C9              xor ecx,ecx
0000077B  09C0              or eax,eax
0000077D  7505              jnz 0x784
0000077F  31C0              xor eax,eax
00000781  48                dec eax
00000782  EB2F              jmp short 0x7b3
00000784  E8C7FFFFFF        call 0x750
00000789  72F4              jc 0x77f
0000078B  7510              jnz 0x79d
0000078D  F6D3              not bl
0000078F  80E33F            and bl,0x3f
00000792  88D9              mov cl,bl
00000794  8AB3C1A14000      mov dh,[ebx+0x40a1c1]
0000079A  8830              mov [eax],dh
0000079C  40                inc eax
0000079D  E8AEFFFFFF        call 0x750
000007A2  72DB              jc 0x77f
000007A4  750D              jnz 0x7b3
000007A6  30D9              xor cl,bl
000007A8  8AB1C1A14000      mov dh,[ecx+0x40a1c1]
000007AE  8830              mov [eax],dh
000007B0  40                inc eax
000007B1  EBEA              jmp short 0x79d
000007B3  5B                pop ebx
000007B4  C20400            ret 0x4
000007B7  53                push ebx
000007B8  8B442408          mov eax,[esp+0x8]
000007BC  31C9              xor ecx,ecx
000007BE  09C0              or eax,eax
000007C0  7505              jnz 0x7c7
000007C2  31C0              xor eax,eax
000007C4  48                dec eax
000007C5  EB32              jmp short 0x7f9
000007C7  E884FFFFFF        call 0x750
000007CC  72F4              jc 0x7c2
000007CE  750F              jnz 0x7df
000007D0  30D9              xor cl,bl
000007D2  8AB1C1A14000      mov dh,[ecx+0x40a1c1]
000007D8  8830              mov [eax],dh
000007DA  88D9              mov cl,bl
000007DC  40                inc eax
000007DD  EBE8              jmp short 0x7c7
000007DF  8B442408          mov eax,[esp+0x8]
000007E3  E868FFFFFF        call 0x750
000007E8  72D8              jc 0x7c2
000007EA  750D              jnz 0x7f9
000007EC  F6D3              not bl
000007EE  80E33F            and bl,0x3f
000007F1  8AB3C1A14000      mov dh,[ebx+0x40a1c1]
000007F7  8830              mov [eax],dh
000007F9  5B                pop ebx
000007FA  C20400            ret 0x4

The function find() and deCript() + the string abc: 171 bytes + 64 bytes=235
assembly with nasmw and compiler/library with Borland C compiler:
; nasmw -fobj  this.asm
; bcc32 -v  this.obj
section _DATA use32 public class=DATA
global _main
extern _printf

fmt1 db "result=%s" , 13, 10, 0, 0
fmt2 db "abc[63]=%c" , 13, 10, 0, 0
code1 db "code" , 0, 0
code2 db ",&'8[14 =?;gp+% 2'@s&&c45/eg8?&" , 0, 0
code3 db ';a$5$%0r?2@12dw6# lb-eg&519nt%ot=9$@es@96+?;ga" 4*)&ta56dp[?o#t%oh/"(&?#ee![,+,/+fe4"' , 0, 0
abc db ' !"#$%' , "&'()*+,-./0123456789:;=?@[\]^_abcdefghijklmnopqrstuvwxyz|~" , 0, 0

section _TEXT use32 public class=CODE

find:
      push    eax
      mov     dl,  [eax]
      cmp     dl,  0
      je      .2
      xor     ebx,  ebx
      jmp     short  .1
.e:   stc
      jmp     short  .z
.1:   mov     al,  [abc+ebx]
      cmp     al,  0
      je      .e
      cmp     dl,  al
      je      .3
      inc     ebx
      jmp     short  .1
.2:   inc     edx           ; set zf=0
.3:   clc
.z:   pop     eax
      ret

deCript:
      push    ebx
      mov     eax,  dword[esp+8]
      xor     ecx,  ecx
      or      eax,  eax
      jnz     .1
.e:   xor     eax,  eax
      dec     eax
      jmp     short  .z
.1:   call    find
      jc      .e
      jnz     .2
      not     bl
      and     bl,  03Fh
      mov     cl,  bl
      mov     dh,  [abc+ebx]
      mov     [eax],  dh
      inc     eax
.2:   call    find
      jc      .e
      jnz     .z
      xor     cl,  bl
      mov     dh,  [abc+ecx]
      mov     [eax],  dh
      inc     eax
      jmp     short  .2
.z:
      pop     ebx
      ret     4

cript:
      push    ebx
      mov     eax,  dword[esp+8]
      xor     ecx,  ecx
      or      eax,  eax
      jnz     .1
.e:   xor     eax,  eax
      dec     eax
      jmp     short  .z
.1:   call    find
      jc      .e
      jnz     .2
      xor     cl,  bl
      mov     dh,  [abc+ecx]
      mov     [eax],  dh
      mov     cl,  bl
      inc     eax
      jmp     short  .1
.2:   mov     eax,  dword[esp+8]
      call    find
      jc      .e
      jnz     .z
      not     bl
      and     bl,  03Fh
      mov     dh,  [abc+ebx]
      mov     [eax],  dh
.z:
      pop     ebx
      ret     4

_main:
      pushad

      push    code1
      call    cript
      push    code1
      push    fmt1
      call    _printf
      add     esp,  8

      xor     eax,  eax
      mov     al,  [abc+63]
      push    eax
      push    fmt2
      call    _printf
      add     esp,  8

      push    code1
      call    deCript
      push    code1
      push    fmt1
      call    _printf
      add     esp,  8
      push    code2
      call    deCript
      push    code2
      push    fmt1
      call    _printf
      add     esp,  8
      push    code3
      call    deCript
      push    code3
      push    fmt1
      call    _printf
      add     esp,  8

      popad
      mov     eax,  0
      ret

results:
result=945/
abc[63]=~
result=code
result=programming puzzles & code golf
result=a $150 reward will be given to those sending account and pin# to hackers@steal_id.com

Assembly is better (for say the true I use a macro system, yes I know it is too long but as the C one +- with macro system , for say the true because the instructions are simpler it is easy write code in assembly even without make corrections as one write in English (not I) )

APL (Dyalog Unicode), 52 bytesSBCS
Requires ⎕IO←0
{C[2∘⊥¨≠\~@0⊢(6/2)∘⊤¨⍵⍳⍨C←(32↓⎕UCS⍳127)~⎕A,'<>{}`']}

Try it online!

Always question usage of ¨: [{C[2⊥≠\⍉~@0⍉(6/2)⊤⍵⍳⍨C←(32↓⎕UCS⍳127)~⎕A,'<>{}\']}`](https://tio.run/##SyzI0U2pTMzJT///qG@qp/@jtgkG/6udo40edS191Lkg5lFvZ52DAZDUMNM30nzUteRR79ZHvZsf9a5wBirVMDZ61DYZqDHUORgoamhkrlkH5DnqqNvYVdcmqMfW/k8DKnvU2wcxvKv50HrjR20TgbzgIGcgGeLhGfw/TUHd0sRUX50LyNBRU1e3iDY0UbC1t04v0FZVMFJXdyhWU0sGKkhNt7BXA6uyTlQxVVE1KLI3cjA0Sik3U1bISdJNTVczNbTMK1HNL7G1VHFILXawNNMGmpKopGCipalWkmhqllIQbZ@vDFSRoa@koWavnJqqGK2jraOvnZZqogQ2uU5RWVFdHUjowxjRGCLEqFEHAA "APL (Dyalog Unicode) – Try It Online")

When there's only one reference to ⍵, you can save two bytes by conversion to a full program: [C[2⊥≠\⍉~@0⍉(6/2)⊤⍞⍳⍨C←(32↓⎕UCS⍳127)~⎕A,'<>{}\']`](https://tio.run/##SyzI0U2pTMzJT///qG@qp/@jtgkGXI862tP@O0cbPepa@qhzQcyj3s46BwMgqWGmb6T5qGvJo955j3o3P@pd4QxUrmFs9KhtMlBzqHMwUNTQyFyzDshz1FG3sauuTVCP/Q807r8CGKQpcFmamOpzQXlcOmrqFtGGJgq29tbpBdqqCkbqDsVqaslAJanpFvZqcHXWiSqmKqoGRfZGDoZGKeVmygo5Sbqp6WqmhpZ5Jar5JbaWKg6pxQ6WZtpAgxKVFEy0NNVKEk3NUgqi7fOVgSoy9JU01OyVU1MVo3W0dfS101JNlOCm1ykqK6oDsT6UjkbjE5IHAA "APL (Dyalog Unicode) – Try It Online")

Röda, 120 100 bytes
f a{A=[]seq 32,126|chr _|{|v|A+=v if[v=~"[^<>`{}A-Z]"]}_;l=63;a|{|c|l=indexOf(c,A) b_xor l;[A[l]]}_}

Try it online!
I used the l=63 trick from the JavaScript answer. Right now I am working on shortening A so golfing in progress...

Python 2, 155 bytes
lambda s,m=' !"#$%&\'()*+,-./0123456789:;=?@[\\]^_abcdefghijklmnopqrstuvwxyz|~':''.join(m[i]for i in reduce(lambda a,b:a+[a[-1]^b],map(m.find,s),[63])[1:])

Try it online!

PHP, 103 Bytes
for($x=63;~$c=$argn[$i++];)echo($a=join(preg_grep("#[^A-Z<>`{}]#",range(" ","~"))))[$x^=strpos($a,$c)];

Try it online!
PHP, 107 Bytes
for($x=63;~$c=$argn[$i++];)echo($a=preg_filter("#[A-Z<>`{}]#","",join(range(" ","~"))))[$x^=strpos($a,$c)];

Try it online!
PHP, 118 Bytes
for($x=63;~$c=$argn[$i++];)echo($a=join(array_diff(range(" ","~"),range(A,Z),str_split("<>`{}"))))[$x^=strpos($a,$c)];

Try it online!

Python + Numpy, 214 bytes
Can't compete with other Python solution, though uses different, pure numeric approach:
from numpy import *
def f(s):
    r=range
    A=array
    S=A(r(32,60)+[61,63,64]+r(91,96)+r(97,123)+[124,126])
    T=A(r(128))
    T[S]=A(r(64))
    W=T[fromstring(s,"b")]
    W[0]=~W[0]
    W=S[bitwise_xor.accumulate(W)&63]
    print W.tobytes()[::4]

A bit of explanation:

S=A(r(32,60)+...) - define alphabet as code ranges
T=A(r(128))  - init hash table of size 128 (largest codepoint)
T[S]=A(r(64)) - fill the hash table, i.e. write indices 0-63 to the elements with ASCII indices
W=T[fromstring(s,"b")] - convert the input to array & translate it into new codes
W[0]=~W[0] - invert 1st value
W=S[bitwise_xor.accumulate(W)&63]  - use Numpy's accumulate method with xor to avoid looping, reset 2 left bits and translate back to ascii

Alice, 46 bytes
/" >"{""ZNr\'?wi.h%)qXq&[.&]?oe(K
\"<~`r}A*"!/

Try it online!
Explanation
The first half of the program runs in ordinal mode and sets up the mapping from numbers to characters.  The second half runs in cardinal mode and uses this mapping to decode the input.
" ~"                    Push this string
    r                   Convert to entire range (all printable ASCII)
     "AZ"               Push this string
         r              Convert to entire range
          "<>`{}"       Push this string
                 *      Append last two strings
                  N     Remove characters from full string
                   !    Copy entire string to tape

'?                      Push 63 (code point of ?) onto the stack
  w                     Store return address (start main loop)
   i                    Take byte of input
    .h%                 Calculate n mod (n+1): this crashes on EOF (-1)
       )                Find byte on tape
        q               Get position on tape
         X              Bitwise XOR with current value
          q&[           Return to tape position 0
             .&]        Move to tape position corresponding to result of earlier XOR
                ?o      Get and output byte at current tape position
                  e(    Search for -1 to left of current tape position (which will put us at position -1)
                    K   Jump to previously pushed return address.

105 103 bytes, machine code (16-bit x86), 57 instructions
00000000: ff 01 b9 01 00 89 fa b4 3f cd 21 85 c0 75 02 cd
00000010: 20 8a 05 2c 20 3c 1d 72 1b 48 3c 1e 72 16 48 3c
00000020: 39 72 11 2c 1a 3c 25 72 0b 48 3c 3f 72 06 48 3c
00000030: 40 72 01 48 32 04 24 3f 88 04 3c 3f 72 01 40 3c
00000040: 3e 72 01 40 3c 24 72 01 40 3c 1f 72 02 04 1a 3c
00000050: 1d 72 01 40 3c 1c 72 01 40 04 20 43 89 d9 88 05
00000060: b4 40 cd 21 4b eb 9b

Running: save to codegolf.com, dosbox:
codegolf.com < input.bin
Almost forgot fun part:
Howdy, this is my second entry. Previous one was RC4.
Done using HT hexeditor, without compiler, but this time I was using Ctrl-a assemble instruction, I still dunno if this
counts as an entry or not.
Why & how
In as similar manner I've started by creating file with NOPs, then
I reused reading in /writing out from RC4.
I first written in python 'translation ladder' from ascii to index.
and used that in assembly, created similar ladder in reverse direction,
finally I added small trick to handle first byte
In a similar fashion to RC4 last step was getting rid of additional nops,
which required fixing jumps.
Dissection
Again program relies on initial register values.
00000000 ff01                    inc         word ptr [bx+di]

Dummy, will be needed later
00000002 b90100                  mov         cx, 0x1
00000005 89fa                    mov         dx, di
00000007 b43f                    mov         ah, 0x3f
00000009 cd21                    int         0x21

read byte
0000000b 85c0                    test        ax, ax
0000000d 7502                    jnz         0x11
0000000f cd20                    int         0x20

quit if stdin finished
00000011 8a05                    mov         al, [di]
00000013 2c20                    sub         al, 0x20
00000015 3c1d                    cmp         al, 0x1d
00000017 721b                    jc          0x34
00000019 48                      dec         ax
0000001a 3c1e                    cmp         al, 0x1e
0000001c 7216                    jc          0x34
0000001e 48                      dec         ax
0000001f 3c39                    cmp         al, 0x39
00000021 7211                    jc          0x34
00000023 2c1a                    sub         al, 0x1a
00000025 3c25                    cmp         al, 0x25
00000027 720b                    jc          0x34
00000029 48                      dec         ax
0000002a 3c3f                    cmp         al, 0x3f
0000002c 7206                    jc          0x34
0000002e 48                      dec         ax
0000002f 3c40                    cmp         al, 0x40
00000031 7201                    jc          0x34
00000033 48                      dec         ax

ladder that translates ascii to index (mind that all jumps go to 0x134)
00000034 3204                    xor         al, [si]

xor byte by previous byte, SI points at address 0x100,
which initially contains 0xFF from the opcode of a dummy instruction
at the top, which results in negate behavior
(reminder: COMs are loaded at 0x100)
00000036 243f                    and         al, 0x3f
00000038 8804                    mov         [si], al

limit result to index, and store byte at 0x100,
0000003a 3c3f                    cmp         al, 0x3f
0000003c 7201                    jc          0x3f
0000003e 40                      inc         ax
0000003f 3c3e                    cmp         al, 0x3e
00000041 7201                    jc          0x44
00000043 40                      inc         ax
00000044 3c24                    cmp         al, 0x24
00000046 7201                    jc          0x49
00000048 40                      inc         ax
00000049 3c1f                    cmp         al, 0x1f
0000004b 7202                    jc          0x4f
0000004d 041a                    add         al, 0x1a
0000004f 3c1d                    cmp         al, 0x1d
00000051 7201                    jc          0x54
00000053 40                      inc         ax
00000054 3c1c                    cmp         al, 0x1c
00000056 7201                    jc          0x59
00000058 40                      inc         ax
00000059 0420                    add         al, 0x20

ladder in reverse direction
0000005b 43                      inc         bx
0000005c 89d9                    mov         cx, bx
0000005e 8805                    mov         [di], al
00000060 b440                    mov         ah, 0x40
00000062 cd21                    int         0x21
00000064 4b                      dec         bx

put byte under [di], write byte to stdout (mind that AH=40h uses DX as an
address, but it was set at the top, when reading byte)
mind that stdin -> stdout and stdout to stdin is done using inc bx / dec bx
00000067 eb99                    jmp         0x2

loop ^^
Tools and resources

ht editor - it has 16-bit disasm/assembly
hexplorer - for mouse based copy/paste + insert/overwrite
dosbox - for debugging
Register values at DOS .COM startup

Japt -P, 33 bytes
;
EkB+"<>}\{`"1
¬i63 åÈ^VaYÃÅm!gV

Try it online!
For some reason, the test cases object to running as a suite, so here's the second, third, and fourth individually.
Explanation:
;                    #Set E to a string of all printable ASCII characters

Ek          1        #Set V to E with these characters removed:
  B                  # All uppercase letters
   +"<>}\{`"         # and the characters "<>}{`"

¬                    #Turn the input into an array
 i63                 #Add the number 63 to the front of that array
     å     Ã         #Replace each character with:
      È              # The index of the previous decoded character in V
       ^             # Xor with...
        VaY          # The index of the current character in V
            Å        #Remove the extra character
             m!gV    #Map the indexes to the character in V
                     #Join to a string due to the flag

APL(NARS), 72 chars, 144 bytes
{r←6⍴2⋄y←{r⊤⍵}¨¯1+⍵⍳⍨s←⎕AV[33..127]∼⎕A,'{<>}`'⋄y[1]←⊂∼↑y⋄s[1+{r⊥⍵}¨≠\y]}

This suppose the input is always in the array 's'... For understand how to do decipher i had to write the assembly version first... test:
  h←{r←6⍴2⋄y←{r⊤⍵}¨¯1+⍵⍳⍨s←⎕AV[33..127]∼⎕A,'{<>}`'⋄y[1]←⊂∼↑y⋄s[1+{r⊥⍵}¨≠\y]}
  h ,'6'
f
  h '945/'
code
  h ",&'8[14 =?;gp+% 2'@s&&c45/eg8?&"
programming puzzles & code golf
  h ';a$5$%0r?2@12dw6# lb-eg&519nt%ot=9$@es@96+?;ga" 4*)&ta56dp[?o#t%oh/"(&?#ee![,+,/+fe4"'
a $150 reward will be given to those sending account and pin# to hackers@steal_id.com
  h "~!#!'!#!/!#!'!#![!#!'!#!/!#!'!#!~!#!'!#!/!#!'!#![!#!'!#!/!#!'!#!"
 !"#$%&'()*+,-./0123456789:;=?@[\]^_abcdefghijklmnopqrstuvwxyz|~

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


text:
Are there any functional programming languages designed for code-golfing?
Are there any functional programming languages designed for code golfing? I know that golfscript and CJam fulfill the same category for stack based, but I couldn't find a functional code golfing language.

Define "functional programming languages".

Do you mean something like Haskell?

There's Clip by Ypnypn and Leo and Zgarb are currently designing and implementing a Haskell-based golfing language called Husk.

If C qualifies as a functional language, I wrote shortC.

I'm voting to close this question as off-topic because it has an answer on the meta site: https://codegolf.meta.stackexchange.com/questions/6918/what-programming-languages-have-been-created-by-ppcg-users

@mbomb007 Except that it's limited to languages created by PPCG users... (and contains neither Clip nor Husk but has several languages claiming they're functional although they aren't).

Burlesque isn't entirely functional, but it does have one of the trademark features of functional programming languages, namely lazy lists.

Jelly is tacit, and tacit implies functional, doesn't it?

@MDXF I am assuming the definition of a functional language to be one that primarily uses the functional programming paradigm. Although C has functions, it is typically considered to be a procedural programming language.

@BetaDecay Shouldn't this be on the meta site, though? The question is at least similar to the one I linked, and fits more on meta, I'd think.

@mbomb007 It's not a question about PPCG so it definitely doesn't belong on meta. Whether it belongs on main is arguable, but since we allow other kinds of non-challenge questions about golfing in general (including golfing tips, questions about golfing language design and questions about challenge writing) I don't think this is a bad fit for main.

@mbomb007 No, this is effectively a tips question which are most definitely on topic on main

What are functional programming languages? Pure BF isn't a golfing language, but you could do the same thing to some other languages.

@MDXF The C language is purely functional

Would Jelly count as functional?

@mbomb007 Having an answer on meta doesn't make it off-topic.

@MartinEnder It's not just lists that are lazy, the language itself has lazy evaluation as for example noticeable when writing code like 1R@<-L[vv1. Of course, this property is barely of any use in real code as it's mostly only useful for lists but the language itself is lazy. 1R@<-L[ (eval) would inverse an infinite list and calculate it's length which would never terminate but vv pops an element from the stack so the result of that computation is never needed and thus it's never actually evaluated.

Husk
Husk is a pure functional golfing language created by me and Leo and inspired by Haskell.
It combines a rigid type system, type inference and extensive overloading.
Functions are first class values and can be manipulated as easily as other data.
Development of Husk is ongoing and many features are still missing, but you can try it out at TIO.
We also have a SE chatroom for the language.

cQuents
cQuents is an inpure functional golfing language. It incorporates a lot of functional programming concepts, notably lazy evaluation and infinite lists, since it's specifically designed to do well in sequence related challenges.

Pyth
Pyth is a functional language that transpiles to python

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