Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 71 characters in body
Source Link
didymus
  • 141
  • 4

C# (Visual C# Interactive Compiler), (削除) 254 (削除ここまで) (削除) 234 (削除ここまで) (削除) 230 (削除ここまで) (削除) 229 (削除ここまで) (削除) 228 (削除ここまで) (削除) 209 (削除ここまで) 199(削除) 199 (削除ここまで) 198 bytes

string f(int v,int p=-1){var h=v+p>0h=v>-p?f(v/5,v%5):"ADDAX";return p<0?h[..1]:h[p]+"DDAXISONAMELINGOAGLEOSSAECKOORSENDRIAMBUOALAEMUROUSEYALATTERRAWNUAILOBINQUIDIGERRIALIXENHALEERUSAPOK"[(h[p]*4-260)..];}

Try it online!

How?

char f(int v, int p = -1)
{
 var h = v + p > 0-p ? f(v / 5, v % 5) : "ADDAX";
 return p < 0 ? h[..1] : h[p] + "DDAXISONAMELINGOAGLEOSSAECKOORSENDRIAMBUOALAEMUROUSEYALATTERRAWNUAILOBINQUIDIGERRIALIXENHALEERUSAPOK"[(h[p] * 4 - 260)..];
}

This version is a complete rewrite of my original solution. Inspired from other submissions, I decided to use a recursive function. The gist is still converting v to base 5 and use the digits to point to the correct words. When v and p are both equal to 0, the conversion is complete, so we take ADDAX and stop the recursion.

Zebra was removed from the list because it is not reachable.

Updates:

  • Saved 20 bytes removing the first letter from each word in the string literal.
  • Replacing do/while with a for loop reduced the size by 4 bytes
  • -1 byte using a tuple to assign b and g
  • -1 byte replacing 'A' with 65
  • -1 byte replacing [((h[b] - 65) * 4)..] with [(h[b]*4 - 260)..]
  • -10 bytes using a recursive function
  • -1 byte replacing v+p>0 with v>-p (thanks to @ceilingcat)

C# (Visual C# Interactive Compiler), (削除) 254 (削除ここまで) (削除) 234 (削除ここまで) (削除) 230 (削除ここまで) (削除) 229 (削除ここまで) (削除) 228 (削除ここまで) (削除) 209 (削除ここまで) 199 bytes

string f(int v,int p=-1){var h=v+p>0?f(v/5,v%5):"ADDAX";return p<0?h[..1]:h[p]+"DDAXISONAMELINGOAGLEOSSAECKOORSENDRIAMBUOALAEMUROUSEYALATTERRAWNUAILOBINQUIDIGERRIALIXENHALEERUSAPOK"[(h[p]*4-260)..];}

Try it online!

How?

char f(int v, int p = -1)
{
 var h = v + p > 0 ? f(v / 5, v % 5) : "ADDAX";
 return p < 0 ? h[..1] : h[p] + "DDAXISONAMELINGOAGLEOSSAECKOORSENDRIAMBUOALAEMUROUSEYALATTERRAWNUAILOBINQUIDIGERRIALIXENHALEERUSAPOK"[(h[p] * 4 - 260)..];
}

This version is a complete rewrite of my original solution. Inspired from other submissions, I decided to use a recursive function. The gist is still converting v to base 5 and use the digits to point to the correct words. When v and p are both equal to 0, the conversion is complete, so we take ADDAX and stop the recursion.

Zebra was removed from the list because it is not reachable.

Updates:

  • Saved 20 bytes removing the first letter from each word in the string literal.
  • Replacing do/while with a for loop reduced the size by 4 bytes
  • -1 byte using a tuple to assign b and g
  • -1 byte replacing 'A' with 65
  • -1 byte replacing [((h[b] - 65) * 4)..] with [(h[b]*4 - 260)..]
  • -10 bytes using a recursive function

C# (Visual C# Interactive Compiler), (削除) 254 (削除ここまで) (削除) 234 (削除ここまで) (削除) 230 (削除ここまで) (削除) 229 (削除ここまで) (削除) 228 (削除ここまで) (削除) 209 (削除ここまで) (削除) 199 (削除ここまで) 198 bytes

string f(int v,int p=-1){var h=v>-p?f(v/5,v%5):"ADDAX";return p<0?h[..1]:h[p]+"DDAXISONAMELINGOAGLEOSSAECKOORSENDRIAMBUOALAEMUROUSEYALATTERRAWNUAILOBINQUIDIGERRIALIXENHALEERUSAPOK"[(h[p]*4-260)..];}

Try it online!

How?

char f(int v, int p = -1)
{
 var h = v > -p ? f(v / 5, v % 5) : "ADDAX";
 return p < 0 ? h[..1] : h[p] + "DDAXISONAMELINGOAGLEOSSAECKOORSENDRIAMBUOALAEMUROUSEYALATTERRAWNUAILOBINQUIDIGERRIALIXENHALEERUSAPOK"[(h[p] * 4 - 260)..];
}

This version is a complete rewrite of my original solution. Inspired from other submissions, I decided to use a recursive function. The gist is still converting v to base 5 and use the digits to point to the correct words. When v and p are both equal to 0, the conversion is complete, so we take ADDAX and stop the recursion.

Zebra was removed from the list because it is not reachable.

Updates:

  • Saved 20 bytes removing the first letter from each word in the string literal.
  • Replacing do/while with a for loop reduced the size by 4 bytes
  • -1 byte using a tuple to assign b and g
  • -1 byte replacing 'A' with 65
  • -1 byte replacing [((h[b] - 65) * 4)..] with [(h[b]*4 - 260)..]
  • -10 bytes using a recursive function
  • -1 byte replacing v+p>0 with v>-p (thanks to @ceilingcat)
deleted 156 characters in body
Source Link
didymus
  • 141
  • 4

C# (Visual C# Interactive Compiler), (削除) 254 (削除ここまで) (削除) 234 (削除ここまで) (削除) 230 (削除ここまで) (削除) 229 (削除ここまで) (削除) 228 (削除ここまで) 227(削除) 209 (削除ここまで) 199 bytes

charstring f(int v){Func<string,string>f=s=>s;for(;v>0;v/=5int p=-1){var h=v+p>0?f(bv/5,g)=(v%5,f);f=h=>g(h[b]+"DDAXISONAMELINGOAGLEOSSAECKOORSENDRIAMBUOALAEMUROUSEYALATTERRAWNUAILOBINQUIDIGERRIALIXENHALEERUSAPOK"[:"ADDAX";return p<0?h[..1]:h[p]+"DDAXISONAMELINGOAGLEOSSAECKOORSENDRIAMBUOALAEMUROUSEYALATTERRAWNUAILOBINQUIDIGERRIALIXENHALEERUSAPOK"[(h[b]*4h[p]*4-260)..]);}return f("ADDAX")[0];];}

Try it online! Try it online!

How?

char f(int v)
{
 Func<string, string>int fp = s => s;
 for(;v>0;v/=5-1)
{
 {
var h = v + p > 0 var? f(b,v g)/ =5, (v % 5, f);
 : "ADDAX";
 return p f< =0 h? =>h[..1] g(h[b]: h[p] + "DDAXISONAMELINGOAGLEOSSAECKOORSENDRIAMBUOALAEMUROUSEYALATTERRAWNUAILOBINQUIDIGERRIALIXENHALEERUSAPOK"[(h[b]*4h[p] * 4 - 260)..]);
 }
 return f("ADDAX")[0];];
}

This version is a complete rewrite of my original solution. Inspired from other submissions, I decided to use a recursive function. The loopgist is an unreadable mess that convertsstill converting v to base 5 and storesuse the digits in the closure. This is done by storing the remainder of division by 5 in b, which is used by the closure to point to the correct wordwords. The closure then passes the word to its previous valueWhen (we don't mind sending the whole string after the word wev and p are pointingboth equal to).

At the end of 0, the loopconversion is complete, so we call f withtake ADDAX and stop the recursion.

Zebra was removed from the list because it is not reachable.

Updates:

  • I savedSaved 20 bytes removing the first letter from each word in the string literal.
  • Replacing do/while with a for loop reduced the size by 4 bytes
  • -1 byte using a tuple to assign b and g
  • -1 byte replacing 'A' with 65
  • -1 byte replacing [((h[b] - 65) * 4)..] with [(h[b]*4 - 260)..]
  • -10 bytes using a recursive function

C# (Visual C# Interactive Compiler), (削除) 254 (削除ここまで) (削除) 234 (削除ここまで) (削除) 230 (削除ここまで) (削除) 229 (削除ここまで) (削除) 228 (削除ここまで) 227 bytes

char f(int v){Func<string,string>f=s=>s;for(;v>0;v/=5){var(b,g)=(v%5,f);f=h=>g(h[b]+"DDAXISONAMELINGOAGLEOSSAECKOORSENDRIAMBUOALAEMUROUSEYALATTERRAWNUAILOBINQUIDIGERRIALIXENHALEERUSAPOK"[(h[b]*4-260)..]);}return f("ADDAX")[0];}

Try it online!

How?

char f(int v)
{
 Func<string, string> f = s => s;
 for(;v>0;v/=5)
 {
 var (b, g) = (v % 5, f);
 f = h => g(h[b] + "DDAXISONAMELINGOAGLEOSSAECKOORSENDRIAMBUOALAEMUROUSEYALATTERRAWNUAILOBINQUIDIGERRIALIXENHALEERUSAPOK"[(h[b]*4 - 260)..]);
 }
 return f("ADDAX")[0];
}

The loop is an unreadable mess that converts v to base 5 and stores the digits in the closure. This is done by storing the remainder of division by 5 in b, which is used by the closure to point to the correct word. The closure then passes the word to its previous value (we don't mind sending the whole string after the word we are pointing to).

At the end of the loop, we call f with ADDAX.

Zebra was removed from the list because it is not reachable.

Updates:

  • I saved 20 bytes removing the first letter from each word in the string literal.
  • Replacing do/while with a for loop reduced the size by 4 bytes
  • -1 byte using a tuple to assign b and g
  • -1 byte replacing 'A' with 65
  • -1 byte replacing [((h[b] - 65) * 4)..] with [(h[b]*4 - 260)..]

C# (Visual C# Interactive Compiler), (削除) 254 (削除ここまで) (削除) 234 (削除ここまで) (削除) 230 (削除ここまで) (削除) 229 (削除ここまで) (削除) 228 (削除ここまで) (削除) 209 (削除ここまで) 199 bytes

string f(int v,int p=-1){var h=v+p>0?f(v/5,v%5):"ADDAX";return p<0?h[..1]:h[p]+"DDAXISONAMELINGOAGLEOSSAECKOORSENDRIAMBUOALAEMUROUSEYALATTERRAWNUAILOBINQUIDIGERRIALIXENHALEERUSAPOK"[(h[p]*4-260)..];}

Try it online!

How?

char f(int v, int p = -1)
{
 var h = v + p > 0 ? f(v / 5, v % 5) : "ADDAX";
 return p < 0 ? h[..1] : h[p] + "DDAXISONAMELINGOAGLEOSSAECKOORSENDRIAMBUOALAEMUROUSEYALATTERRAWNUAILOBINQUIDIGERRIALIXENHALEERUSAPOK"[(h[p] * 4 - 260)..];
}

This version is a complete rewrite of my original solution. Inspired from other submissions, I decided to use a recursive function. The gist is still converting v to base 5 and use the digits to point to the correct words. When v and p are both equal to 0, the conversion is complete, so we take ADDAX and stop the recursion.

Zebra was removed from the list because it is not reachable.

Updates:

  • Saved 20 bytes removing the first letter from each word in the string literal.
  • Replacing do/while with a for loop reduced the size by 4 bytes
  • -1 byte using a tuple to assign b and g
  • -1 byte replacing 'A' with 65
  • -1 byte replacing [((h[b] - 65) * 4)..] with [(h[b]*4 - 260)..]
  • -10 bytes using a recursive function
added 77 characters in body
Source Link
didymus
  • 141
  • 4

C# (Visual C# Interactive Compiler), (削除) 254 (削除ここまで) (削除) 234 (削除ここまで) (削除) 230 (削除ここまで) (削除) 229 (削除ここまで) 228(削除) 228 (削除ここまで) 227 bytes

char f(int v){Func<string,string>f=s=>s;for(;v>0;v/=5){var(b,g)=(v%5,f);f=h=>g(h[b]+"DDAXISONAMELINGOAGLEOSSAECKOORSENDRIAMBUOALAEMUROUSEYALATTERRAWNUAILOBINQUIDIGERRIALIXENHALEERUSAPOK"[((h[b]h[b]*4-65)*4260)..]);}return f("ADDAX")[0];}

Try it online! Try it online!

How?

char f(int v)
{
 Func<string, string> f = s => s;
 for(;v>0;v/=5)
 {
 var (b, g) = (v % 5, f);
 f = h => g(h[b] + "DDAXISONAMELINGOAGLEOSSAECKOORSENDRIAMBUOALAEMUROUSEYALATTERRAWNUAILOBINQUIDIGERRIALIXENHALEERUSAPOK"[((h[b]h[b]*4 - 65) * 4260)..]);
 }
 return f("ADDAX")[0];
}

The loop is an unreadable mess that converts v to base 5 and stores the digits in the closure. This is done by storing the remainder of division by 5 in b, which is used by the closure to point to the correct word. The closure then passes the word to its previous value (we don't mind sending the whole string after the word we are pointing to).

At the end of the loop, we call f with ADDAX.

Zebra was removed from the list because it is not reachable.

Updates:

  • I saved 20 bytes removing the first letter from each word in the string literal.
  • Replacing do/while with a for loop reduced the size by 4 bytes
  • -1 byte using a tuple to assign b and g
  • -1 byte replacing 'A' with 65
  • -1 byte replacing [((h[b] - 65) * 4)..] with [(h[b]*4 - 260)..]

C# (Visual C# Interactive Compiler), (削除) 254 (削除ここまで) (削除) 234 (削除ここまで) (削除) 230 (削除ここまで) (削除) 229 (削除ここまで) 228 bytes

char f(int v){Func<string,string>f=s=>s;for(;v>0;v/=5){var(b,g)=(v%5,f);f=h=>g(h[b]+"DDAXISONAMELINGOAGLEOSSAECKOORSENDRIAMBUOALAEMUROUSEYALATTERRAWNUAILOBINQUIDIGERRIALIXENHALEERUSAPOK"[((h[b]-65)*4)..]);}return f("ADDAX")[0];}

Try it online!

How?

char f(int v)
{
 Func<string, string> f = s => s;
 for(;v>0;v/=5)
 {
 var (b, g) = (v % 5, f);
 f = h => g(h[b] + "DDAXISONAMELINGOAGLEOSSAECKOORSENDRIAMBUOALAEMUROUSEYALATTERRAWNUAILOBINQUIDIGERRIALIXENHALEERUSAPOK"[((h[b] - 65) * 4)..]);
 }
 return f("ADDAX")[0];
}

The loop is an unreadable mess that converts v to base 5 and stores the digits in the closure. This is done by storing the remainder of division by 5 in b, which is used by the closure to point to the correct word. The closure then passes the word to its previous value (we don't mind sending the whole string after the word we are pointing to).

At the end of the loop, we call f with ADDAX.

Zebra was removed from the list because it is not reachable.

Updates:

  • I saved 20 bytes removing the first letter from each word in the string literal.
  • Replacing do/while with a for loop reduced the size by 4 bytes
  • -1 byte using a tuple to assign b and g
  • -1 byte replacing 'A' with 65

C# (Visual C# Interactive Compiler), (削除) 254 (削除ここまで) (削除) 234 (削除ここまで) (削除) 230 (削除ここまで) (削除) 229 (削除ここまで) (削除) 228 (削除ここまで) 227 bytes

char f(int v){Func<string,string>f=s=>s;for(;v>0;v/=5){var(b,g)=(v%5,f);f=h=>g(h[b]+"DDAXISONAMELINGOAGLEOSSAECKOORSENDRIAMBUOALAEMUROUSEYALATTERRAWNUAILOBINQUIDIGERRIALIXENHALEERUSAPOK"[(h[b]*4-260)..]);}return f("ADDAX")[0];}

Try it online!

How?

char f(int v)
{
 Func<string, string> f = s => s;
 for(;v>0;v/=5)
 {
 var (b, g) = (v % 5, f);
 f = h => g(h[b] + "DDAXISONAMELINGOAGLEOSSAECKOORSENDRIAMBUOALAEMUROUSEYALATTERRAWNUAILOBINQUIDIGERRIALIXENHALEERUSAPOK"[(h[b]*4 - 260)..]);
 }
 return f("ADDAX")[0];
}

The loop is an unreadable mess that converts v to base 5 and stores the digits in the closure. This is done by storing the remainder of division by 5 in b, which is used by the closure to point to the correct word. The closure then passes the word to its previous value (we don't mind sending the whole string after the word we are pointing to).

At the end of the loop, we call f with ADDAX.

Zebra was removed from the list because it is not reachable.

Updates:

  • I saved 20 bytes removing the first letter from each word in the string literal.
  • Replacing do/while with a for loop reduced the size by 4 bytes
  • -1 byte using a tuple to assign b and g
  • -1 byte replacing 'A' with 65
  • -1 byte replacing [((h[b] - 65) * 4)..] with [(h[b]*4 - 260)..]
added 41 characters in body
Source Link
didymus
  • 141
  • 4
Loading
deleted 46 characters in body
Source Link
didymus
  • 141
  • 4
Loading
added 65 characters in body
Source Link
didymus
  • 141
  • 4
Loading
added 65 characters in body
Source Link
didymus
  • 141
  • 4
Loading
added 45 characters in body
Source Link
didymus
  • 141
  • 4
Loading
Added "How" section
Source Link
didymus
  • 141
  • 4
Loading
Source Link
didymus
  • 141
  • 4
Loading

AltStyle によって変換されたページ (->オリジナル) /