Generate Aheui Number Make a Number Expression is related : actually, it is also about Aheui. But it just made number expression, but this made real Aheui code.



Aheui is esolang written in only Korean character. Because of its nature, Aheui can't use Arabic numbers.

But, of course, there is way to generate number.

Brief introduction to Aheui

Reading the link above is best, but put it shortly : Aheui is befunge-like esolang : have cursor, every character is instructor, and using stack.

One instructor, looks like 박, have three part : Initial consonantㅂ, vowelㅏ, final consonantㄱ.

First part, initial consonant, determine what to do.

Here is table of initial consonant that can be useful here:


ㅇ : no operation.
ㅎ : terminate.
ㄷ : pop two number from current stack, than add them, and push to current stack.
ㄸ : same as ㄷ, but multiply instead of add.
ㄴ : pop two number from current stack, push second // first to current stack.
ㅌ : same as ㄴ, but subtract instead of divide.
ㄹ : same as ㄴ, but modulo instead of divide.
ㅂ : push number to current stack. Number is given by final consonant.
ㅃ : duplicate top of current stack.
ㅍ : swap top two value of current stack.


Second part, vowel, determine momentum. Maybe you just need ㅏ, go to next.

Last part, final consonant, determine number to used in ㅂ commend.

Here is list of final consonant and number.


Nothing
ㄱ, ㄴ, ㅅ
ㄷ, ㅈ, ㅋ
ㅁ, ㅂ, ㅊ, ㅌ, ㅋ, ㄲ, ㄳ, ㅆ
ㄹ, ㄵ, ㄶ
ㅄ
ㄺ, ㄽ
ㅀ
ㄻ, ㄼ


Finally, 망 is printing operator. Your code have to print 망희 or 망하 or whatever after calculation, to print and terminate the program.

Korean Character

Every Aheui instructor is Korean character.

As I mentioned above, Korean character has three part : Initial consonant(choseong or 초성), Vowel(jungseong or 중성), Final consonant(jongseong or 종성).

Every character has initial consonant and vowel, but final consonant is option.

Korean character in Unicode is from AC00(가) to D7A3(힣).

For composing Korean character, look at this webpage for help.

Question

Input is an positive integer. Generate aheui code that prints given integer, without hardcode every possibility.

You can test your Aheui code at try it online.

Examples

Input | Output | Discription
1 | 반밧나망희 | Put two 2s in stack, divide, print, and halt.
1 | 반반나망희 | Same as above.
1 | 밪반타망희 | Put 3 then 2 in stack, subtract, print, and halt.
3 | 받망희 | Put 3 in stack, print, halt.
3 | 반밧나빠빠다다망희 | Put two 2s in stack, divide, duplicate two times, add two times, print, halt. This is OK, but won't get good point.
72 | 밢밣따망희 | Put 8 and 9 in stack, multiply, print, and halt.
10 | 박밙따망희 | Put 2 and 5 in stack, multiply, print, and halt.


Scoring

Average length of 101 Aheui codes that prints 100 to 200. If score is same, shorter code wins.
Wolfram Language (Mathematica), score 849/101 = 8.406

g@n_:=f@n&lt;&gt;"망히"
f@n_:=f@n=Switch[n,-1,"밯",1,"반반나",9,"밞",8,"밣",7,"밝",6,"밦",5,"발",4,"밗",3,"받",2,"박",
_,mn@{m@n,a@n,s@n}]
m@n_:=m@n=f@#&lt;&gt;If[# #==n,"빠",f[n/#]]&lt;&gt;"따"&amp;/@Select[Divisors@n,1&lt;# #&lt;=n&amp;]//mn
a@n_:=a@n=f@#&lt;&gt;f[n-#]&lt;&gt;"다"&amp;/@Range[⌈n/2⌉-1]//mn
s@n_:=s@n=m[n+#]&lt;&gt;f@#&lt;&gt;"타"&amp;/@Range[n-1]//mn
mn=First@*MinimalBy[StringLength[""&lt;&gt;#]&amp;]


Try it online!

Builds numbers with 다 (+) 따 (*) 타 (-), and 빠 (duplicate), in addition to literals for 2..9. Doesn't actually make use of 밯=-1.

Paste the tio output (Unicode character codes) into Mathematica to see the result:


100 -> 밗발빠따따망히
101 -> 박밞박밞다따다망히
102 -> 밦밣밞다따망히
103 -> 받밗발빠따따다망히
104 -> 밣밗밞다따망히
105 -> 받발밝따따망히
106 -> 박밗밝빠따다따망히
107 -> 박받발밝따따다망히
108 -> 박밦밞따따망히
109 -> 밗받발밝따따다망히
110 -> 박발박밞다따따망히
111 -> 받박발밝따다따망히
112 -> 박밝밣따따망히
113 -> 발박밦밞따따다망히
114 -> 박받밦밞따다따망히
115 -> 발박받밝따다따망히
116 -> 박박밝밣따다따망히
117 -> 밞밗밞다따망히
118 -> 박받밝밣따다따망히
119 -> 밝밣밞다따망히
120 -> 받발밣따따망히
121 -> 박밞다빠따망히
122 -> 박발밝밣따다따망히
123 -> 받발밗밞따다따망히
124 -> 박밦밝밣따다따망히
125 -> 발발빠따따망히
126 -> 박밝밞따따망히
127 -> 박발발빠따따다망히
128 -> 박밣빠따따망히
129 -> 받받발밣따다따망히
130 -> 박발밗밞다따따망히
131 -> 받박밣빠따따다망히
132 -> 박밦박밞다따따망히
133 -> 밝박밣밞다다따망히
134 -> 박받밣빠따다따망히
135 -> 받발밞따따망히
136 -> 밣밣밞다따망히
137 -> 박받발밞따따다망히
138 -> 박발밣빠따다따망히
139 -> 받밣밣밞다따다망히
140 -> 밗발밝따따망히
141 -> 받박발밞따다따망히
142 -> 박밝밣빠따다따망히
143 -> 박밞다밗밞다따망히
144 -> 박밣밞따따망히
145 -> 발박받밞따다따망히
146 -> 박밞밣빠따다따망히
147 -> 받밝빠따따망히
148 -> 박박밣밞따다따망히
149 -> 박받밝빠따따다망히
150 -> 발발밦따따망히
151 -> 밗받밝빠따따다망히
152 -> 박밗밣밞따다따망히
153 -> 밞밣밞다따망히
154 -> 박밝박밞다따따망히
155 -> 발받밗밝따다따망히
156 -> 박밦밗밞다따따망히
157 -> 밗밞밣밞다따다망히
158 -> 박밝밣밞따다따망히
159 -> 받밗밝빠따다따망히
160 -> 밗발밣따따망히
161 -> 밝박받밝따다따망히
162 -> 박밞빠따따망히
163 -> 받밗발밣따따다망히
164 -> 밗발밗밞따다따망히
165 -> 받발박밞다따따망히
166 -> 박박밞빠따다따망히
167 -> 발박밞빠따따다망히
168 -> 받밝밣따따망히
169 -> 밗밞다빠따망히
170 -> 박발밣밞다따따망히
171 -> 받받밦밞따다따망히
172 -> 박발밞빠따다따망히
173 -> 밗밗밞다빠따다망히
174 -> 박밦밞빠따다따망히
175 -> 발발밝따따망히
176 -> 박밣박밞다따따망히
177 -> 받받밝밣따다따망히
178 -> 박밣밞빠따다따망히
179 -> 밗발발밝따따다망히
180 -> 밗발밞따따망히
181 -> 밦발발밝따따다망히
182 -> 박밝밗밞다따따망히
183 -> 받발밝밣따다따망히
184 -> 밗밗밦밝따다따망히
185 -> 발박발밝따다따망히
186 -> 받밦밝밣따다따망히
187 -> 박밞다밣밞다따망히
188 -> 밗박발밞따다따망히
189 -> 받밝밞따따망히
190 -> 발박밗밞따다따망히
191 -> 박받밝밞따따다망히
192 -> 받밣빠따따망히
193 -> 밗받밝밞따따다망히
194 -> 박받밣빠따따다망히
195 -> 받발밗밞다따따망히
196 -> 밗밝빠따따망히
197 -> 발받밣빠따따다망히
198 -> 박밞박밞다따따망히
199 -> 받밗밝빠따따다망히
200 -> 발발밣따따망히


The lowest number that improves with 타 is 211, with 받밣밞따따발타 (3*8*9-5) beating out 발밠밝따따반반나다 (5*6*7+2/2).

The next lowest, 239 (받밞빠따따밗타=3*9*9-4), didn't require 반반나 in its 다/따-only construction (받밣밞따밝다따박다=3*(8*9+7)+2).

An earlier version of this program generated 다/따-only constructions.



With 밯=-1 (score unchanged)

g@n_:=f@n&lt;&gt;"망히"
f@n_:=f@n=Switch[n,1,"밯",9,"밞",8,"밣",7,"밝",6,"밦",5,"발",4,"밗",3,"받",2,"박",
_,mn@{m@n,a@n,s@n}]
m@n_:=m@n=f@#&lt;&gt;If[# #==n,"빠",f[n/#]]&lt;&gt;"따"&amp;/@Select[Divisors@n,1&lt;# #&lt;=n&amp;]//mn
a@n_:=a@n=f@#&lt;&gt;f[n-#]&lt;&gt;If[#==1,"타","다"]&amp;/@Range[⌈n/2⌉-1]//mn
s@n_:=s@n=m[n+#]&lt;&gt;f@#&lt;&gt;If[#==1,"다","타"]&amp;/@Range[n-1]//mn
mn=First@*MinimalBy[StringLength[""&lt;&gt;#]&amp;]


Try it online!

If the program is given no input, 밯 (read a character from input) returns -1, which allows for a one-character 1 literal.

The lowest number that benefits from this is 269, which improves to 발밦밞따따밯다 (5*6*9+(-1)) from 박받밣밞빠따다따다 (2+3*(8+9*9)).