2
\$\begingroup\$

Tama was a cat born 26 years ago today who gained fame for being a railway station master and operating officer at Kishi Station on the Kishigawa Line in Kinokawa, Wakayama Prefecture, Japan.

Tama in 2007

Photo credit: User:Sanpei on Japanese Wikipedia, CC BY-SA 3.0

On her death, she was honored with a Shinto-style funeral at the station and was given the posthumous title "Honorary Eternal Stationmaster", and her successor was named Nitama (lit. "Second Tama")

By this point you understand the assignment. Given an integer in 2..10, return the name of that successor of Tama, that is to say, the preferred reading of n in japanese, concatenated with "tama". Undefined behavior is allowed outside of 2..10.

For the purposes of this challenge, disregard the fact that the cat supposed to be her 3rd successor was not strictly named according to this sequence, and also that Sun-tama-tama didn't actually become her 3rd successor because

the Public Relations representative who had been caring for Sun-tama-tama refused to give the cat up, writing, "I will not let go of this child, she will stay in Okayama."

Input: An integer between 2 and 10 included

Output: A string with the first (but no other) character capitalized, according to the following table (also exhaustive test cases):

input -> output
2 -> Nitama
3 -> Santama
4 -> Yontama
5 -> Gotama
6 -> Rokutama
7 -> Nanatama
8 -> Hachitama
9 -> Kyūtama
10 -> Jūtama

Outputting ū(U+016B) represented as U+0075 U+0304 (latin minuscule u + combining macron diacritic) is allowed. Additional whitespace around the string is allowed, but no other output is.

Translation builtins (such as google sheets' googletranslate()) are allowed.

Bonus brownie points if your solution is capable of handling any integer, but it is by no means required.

This is .

\$\endgroup\$
1
  • \$\begingroup\$ sandbox \$\endgroup\$ Commented Apr 29, 2025 at 12:07

9 Answers 9

5
\$\begingroup\$

Google Sheets, 68 bytes

=index(split("0Ni0San0Yon0Go0Roku0Nana0Hachi0Kyū0Jū",0,,),A1)&"tama"

screenshot

I don't think googletranslate() is of much help here, because 6 gets 6, and six gets . You'd need bahttext() to spell out the number and Apps Script to romanize and transliterate the result, so you could as well use LanguageApp or the Cloud Translation service from the get-go. Also, googletranslate(roman(6), "en", "ja") gets VI.

\$\endgroup\$
0
3
\$\begingroup\$

Free2Edit, 122 121 bytes

gn-2izpNpiix-1izpSpapnix-1izpYpopnix-1izpGpoix-1izpRpopkpuix-1izpNpapnpaix-1iz<<Hachi>>ix-1izpKpypūix-1izpJpūixptpapmpa

Explanation:

gn-2izpNpiix-1izpSpapnix-1izpYpopnix-1izpGpoix-1izpRpopkpuix-1izpNpapnpaix-1iz<<Hachi>>ix-1izpKpypūix-1izpJpūixptpapmpa
gn                                                                                                                      - Get number
  -2izpNpiix                                                                                                            - Check if it's 2 by subtracting 2 and checking if it's zero
            -1izpSpapnix                                                                                                - Check if it's 3 by subtracting 1(-2-1=-3) and checking if it's zero
                        -1izpYpopnix-1izpGpoix-1izpRpopkpuix-1izpNpapnpaix-1iz<<Hachi>>ix-1izpKpypūix-1izpJpūix         - and do that for every value from 2 to 10, and print a corresponding word for each number
                                                                                                               ptpapmpa - and finally, print 'tama'
\$\endgroup\$
1
  • \$\begingroup\$ Welcome to Code Golf! i've taken the liberty of fixing the link in your header, for next time the syntax is [text](link) \$\endgroup\$ Commented Jan 9 at 20:32
2
\$\begingroup\$

JavaScript (Node.js), 64 bytes

n=>'00Ni0San0Yon0Go0Roku0Nana0Hachi0Kyū0Jū'.split(0)[n]+'tama'

Try it online!

Not fun

\$\endgroup\$
2
\$\begingroup\$

Japt -P, 46 bytes

g`kyÅ«tjÅ«tnÑytgÇrk©nÂA®i`qt)¬vu p`taµ

Try it

\$\endgroup\$
2
\$\begingroup\$

Jelly,  40  39 bytes

“}“dƲȦ⁵ȤƝė½ṗ€Ċọḣṡ©ȷ8h1Ẉ³“»j363ỌḲ⁸ị“tama

A full program that accepts an integer argument from \$[2,10]\$ and prints the successor's name.

Try it online!

How?

“...»j363ỌḲ⁸ị“tama - Main Link: integer, N
“...»              - compressed list of strings
                      -> ["J", " Ni San Yon Go Roku Nana Hachi Ky", ""]
     j363          - join with 363
         Ọ         - cast to ordinals (replacing the 363s with 'ū's)
                      -> "Jū Ni San Yon Go Roku Nana Hachi Kyū"
          Ḳ        - split at space characters
           ⁸ị      - {N} 1-index, cyclically, into {that}
                   - implicit print
             “tama - "tama"
                   - implicit print
\$\endgroup\$
2
\$\begingroup\$

Charcoal, 43 bytes

§⁺⁺⪪KyJ²ū⪪”(1¶S″№wΠT⊙⁹✳R?▷^Rσ⎚ujDπ” Ntama

Try it online! Link is to verbose version of code. Explanation:

    KyJ                 Literal string `KyJ`
   ⪪                    Split into substrings of length
       ²                Literal integer `2`
  ⁺                     Vectorised concatenated with
        ū               Literal string `ū` (3 bytes)
 ⁺                      Concatenated with
          ”...”         Compressed string of prefixes for `2`-`8`
         ⪪              Split on spaces
§                       Cyclically indexed by
                N       Input as a number
                        Implicitly print
                 tama   Print literal string `tama`
\$\endgroup\$
2
\$\begingroup\$

05AB1E, 41 bytes

.•6Γvékm4¦^˜«’Λ³Î$+θƶÖˆÁP<½•#ć«™'b₆ûç:I<è

Try it online or verify all test cases.

Explanation:

.•6Γvékm4¦^˜«’Λ³Î$+θƶÖˆÁP<½•
                # Push compressed string "tama jb ni san yon go roku nana hachi kyb"
  #             # Split it on spaces to a list
   ć            # Extract head; push remainder-list and first item separately
    «           # Append this head ("tama") to each item in the list
     ™          # Titlecase each string
      'b       '# Push "b"
        ₆       # Push 36
         û      # Palindromize it to 363
          ç     # Convert that to a character with that codepoint: "ū"
           :    # Replace all "b"s with "ū"s
            I   # Push the input
             <  # Decrease it by 1
              è # Leave the string at that (0-based) index
                # (which is output implicitly as result)

See this 05AB1E tip of mine (section How to compress strings not part of the dictionary?) to understand why .•6Γvékm4¦^˜«’Λ³Î$+θƶÖˆÁP<½• is "tama jb ni san yon go roku nana hachi kyb".

PS: The titlecasing is done before replacing the bs with ūs, because otherwise it would titlecase the Tama after the ūs as well for some reason.. try it online.

\$\endgroup\$
2
\$\begingroup\$

APL+WIN, 75 bytes.

Simple lookup. Prompts for integer between 2 and 10 included

(∊('Ni' 'San' 'Yon' 'Go' 'Roku' 'Nana' 'Hachi' 'Kyu' 'Ju')[⎕-1],'tama')~' '

Try it online! Thanks to Dyalog Classic

\$\endgroup\$
1
\$\begingroup\$

Python, 71 bytes

Simple lambda function that takes an integer as input and uses it as index to select the correct prefix.

lambda i:'0 1 Ni San Yon Go Roku Nana Hachi Kyū Jū'.split()[i]+'tama'

Attempt This Online!

\$\endgroup\$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.