Skip to main content
Used the wrong case of P
Source Link
Delioth
  • 221
  • 1
  • 5

dc, 110 108 104 10498 bytes

[[*]n]sd[dsi[li0[42P]sd[dsi[li0!=dli1-dsi0!=L]dsLx]sl[10si[li0=L]dsLx]sl[Isi[li0!=dli1-dsi0!=L]dsLx]sg[1+]sa10k=L]dsLx]sg[1+]saIk/70*0k1~0!=ad10>ld10=adI>ldI!>g[]p>gIP
echo 'v a (above)'|dc
# Wholly:
>> echo '163 2 [[*]n]sd[dsi[li0[42P]sd[dsi[li0!=dli1-dsi0!=L]dsLx]sl[10si[li0=L]dsLx]sl[Isi[li0!=dli1-dsi0!=L]dsLx]sg[1+]sa10k=L]dsLx]sg[1+]saIk/70*0k1~0!=ad10>ld10=adI>ldI!>g[]p'|dc>gIP'|dc
# outputs:
**
>> 
[[*]n]sd[42P]sd   # Here we store a macro in register d to print 1 * without a newline

[dsi[li0!=dli1-dsi0!=L]dsLx]sl # Store the "less than" case, a for loop which
                        # uses the top-of the stack as it's number of iterations.
[10si[li0[Isi[li0!=dli1-dsi0!=L]dsLx]sg # Store the "greater than" case. It's the above,
                        # but it puts 10 on the stack to use instead.

[1+]sa # Store a macro to add 1 to whatever is the top-of-stack.


10kIk # Set precision at non-zero to allow decimal division

/70* # Divide the top two of the stack, v/a; multiply by 70 (`/700*10` == `/70`)
             # dc is postfix and stack-based, so operators come after operands.

0k1~0!=a     # This is a ceiling function.
|> 0k  # set precision to 0 to perform integer division
|> 1~  # push the quotient of integer division by 1, and then the remainder. (r is top)
|> 0!=a # If the top-of-stack (decimal part) is not 0, add 1 to the quotient

d10>ld10dI>ldI!>g # Conditional statement
|> d10>ldI>l  # (d)uplicate the top, push 10 on. If 10 > the old top, execute the `l`ess-than
          # case, which loops top-of-stack times.
|> d10dI!>g # Complement of the above, using the `g`reater-than to loop 10 times.

[]pIP # print a newline
  • 2 bytes saved by duplicating-saving instead of saving-loading
  • 4 bytes saved dividing by 70
  • 6 bytes from daniero's suggestions (non-strings, ASCII nums instead; 10 => I)

dc, 110 108 104 bytes

[[*]n]sd[dsi[li0!=dli1-dsi0!=L]dsLx]sl[10si[li0!=dli1-dsi0!=L]dsLx]sg[1+]sa10k/70*0k1~0!=ad10>ld10!>g[]p
echo 'v a (above)'|dc
# Wholly:
>> echo '163 2 [[*]n]sd[dsi[li0!=dli1-dsi0!=L]dsLx]sl[10si[li0!=dli1-dsi0!=L]dsLx]sg[1+]sa10k/70*0k1~0!=ad10>ld10!>g[]p'|dc
# outputs:
**
>> 
[[*]n]sd   # Here we store a macro in register d to print 1 * without a newline

[dsi[li0!=dli1-dsi0!=L]dsLx]sl # Store the "less than" case, a for loop which
                        # uses the top-of the stack as it's number of iterations.
[10si[li0!=dli1-dsi0!=L]dsLx]sg # Store the "greater than" case. It's the above,
                        # but it puts 10 on the stack to use instead.

[1+]sa # Store a macro to add 1 to whatever is the top-of-stack.


10k # Set precision at non-zero to allow decimal division

/70* # Divide the top two of the stack, v/a; multiply by 70 (`/700*10` == `/70`)
             # dc is postfix and stack-based, so operators come after operands.

0k1~0!=a     # This is a ceiling function.
|> 0k  # set precision to 0 to perform integer division
|> 1~  # push the quotient of integer division by 1, and then the remainder. (r is top)
|> 0!=a # If the top-of-stack (decimal part) is not 0, add 1 to the quotient

d10>ld10!>g # Conditional statement
|> d10>l  # (d)uplicate the top, push 10 on. If 10 > the old top, execute the `l`ess-than
          # case, which loops top-of-stack times.
|> d10!>g # Complement of the above, using the `g`reater-than to loop 10 times.

[]p # print a newline
  • 2 bytes saved by duplicating-saving instead of saving-loading
  • 4 bytes saved dividing by 70

dc, 110 108 104 98 bytes

[42P]sd[dsi[li0!=dli1-dsi0!=L]dsLx]sl[Isi[li0!=dli1-dsi0!=L]dsLx]sg[1+]saIk/70*0k1~0!=adI>ldI!>gIP
echo 'v a (above)'|dc
# Wholly:
>> echo '163 2 [42P]sd[dsi[li0!=dli1-dsi0!=L]dsLx]sl[Isi[li0!=dli1-dsi0!=L]dsLx]sg[1+]saIk/70*0k1~0!=adI>ldI!>gIP'|dc
# outputs:
**
>> 
[42P]sd   # Here we store a macro in register d to print 1 * without a newline

[dsi[li0!=dli1-dsi0!=L]dsLx]sl # Store the "less than" case, a for loop which
                        # uses the top-of the stack as it's number of iterations.
[Isi[li0!=dli1-dsi0!=L]dsLx]sg # Store the "greater than" case. It's the above,
                        # but it puts 10 on the stack to use instead.

[1+]sa # Store a macro to add 1 to whatever is the top-of-stack.


Ik # Set precision at non-zero to allow decimal division

/70* # Divide the top two of the stack, v/a; multiply by 70 (`/700*10` == `/70`)
             # dc is postfix and stack-based, so operators come after operands.

0k1~0!=a     # This is a ceiling function.
|> 0k  # set precision to 0 to perform integer division
|> 1~  # push the quotient of integer division by 1, and then the remainder. (r is top)
|> 0!=a # If the top-of-stack (decimal part) is not 0, add 1 to the quotient

dI>ldI!>g # Conditional statement
|> dI>l  # (d)uplicate the top, push 10 on. If 10 > the old top, execute the `l`ess-than
          # case, which loops top-of-stack times.
|> dI!>g # Complement of the above, using the `g`reater-than to loop 10 times.

IP # print a newline
  • 2 bytes saved by duplicating-saving instead of saving-loading
  • 4 bytes saved dividing by 70
  • 6 bytes from daniero's suggestions (non-strings, ASCII nums instead; 10 => I)
4 bytes saved
Source Link
Delioth
  • 221
  • 1
  • 5

dc, 110 108 108104 bytes

[[*]n]sd[dsi[li0!=dli1-dsi0!=L]dsLx]sl[10si[li0!=dli1-dsi0!=L]dsLx]sg[1+]sa10k/700/10*0k1~070*0k1~0!=ad10>ld10!>g[]p
echo 'v a (above)'|dc
# Wholly:
>> echo '163 2 [[*]n]sd[dsi[li0!=dli1-dsi0!=L]dsLx]sl[10si[li0!=dli1-dsi0!=L]dsLx]sg[1+]sa10k/700/10*0k1~070*0k1~0!=ad10>ld10!>g[]p'|dc
# outputs:
**
>> 
[[*]n]sd   # Here we store a macro in register d to print 1 * without a newline

[dsi[li0!=dli1-dsi0!=L]dsLx]sl # Store the "less than" case, a for loop which
                        # uses the top-of the stack as it's number of iterations.
[10si[li0!=dli1-dsi0!=L]dsLx]sg # Store the "greater than" case. It's the above,
                        # but it puts 10 on the stack to use instead.

[1+]sa # Store a macro to add 1 to whatever is the top-of-stack.


10k # Set precision at non-zero to allow decimal division

/ 700 / 10 *70* # Divide the top two of the stack, v/a; then dividemultiply by 700, and70 multiply(`/700*10` by== 10`/70`)
             # dc is postfix and stack-based, so operators come after operands.

0k1~0!=a     # This is a ceiling function.
|> 0k  # set precision to 0 to perform integer division
|> 1~  # push the quotient of integer division by 1, and then the remainder. (r is top)
|> 0!=a # If the top-of-stack (decimal part) is not 0, add 1 to the quotient

d10>ld10!>g # Conditional statement
|> d10>l  # (d)uplicate the top, push 10 on. If 10 > the old top, execute the `l`ess-than
          # case, which loops top-of-stack times.
|> d10!>g # Complement of the above, using the `g`reater-than to loop 10 times.

[]p # print a newline
  • 2 bytes saved by duplicating-saving instead of saving-loading
  • 4 bytes saved dividing by 70

dc, 110 108 bytes

[[*]n]sd[dsi[li0!=dli1-dsi0!=L]dsLx]sl[10si[li0!=dli1-dsi0!=L]dsLx]sg[1+]sa10k/700/10*0k1~0!=ad10>ld10!>g[]p
echo 'v a (above)'|dc
# Wholly:
>> echo '163 2 [[*]n]sd[dsi[li0!=dli1-dsi0!=L]dsLx]sl[10si[li0!=dli1-dsi0!=L]dsLx]sg[1+]sa10k/700/10*0k1~0!=ad10>ld10!>g[]p'|dc
# outputs:
**
>> 
[[*]n]sd   # Here we store a macro in register d to print 1 * without a newline

[dsi[li0!=dli1-dsi0!=L]dsLx]sl # Store the "less than" case, a for loop which
                        # uses the top-of the stack as it's number of iterations.
[10si[li0!=dli1-dsi0!=L]dsLx]sg # Store the "greater than" case. It's the above,
                        # but it puts 10 on the stack to use instead.

[1+]sa # Store a macro to add 1 to whatever is the top-of-stack.


10k # Set precision at non-zero to allow decimal division

/ 700 / 10 * # Divide the top two of the stack, v/a; then divide by 700, and multiply by 10
             # dc is postfix and stack-based, so operators come after operands.

0k1~0!=a     # This is a ceiling function.
|> 0k  # set precision to 0 to perform integer division
|> 1~  # push the quotient of integer division by 1, and then the remainder. (r is top)
|> 0!=a # If the top-of-stack (decimal part) is not 0, add 1 to the quotient

d10>ld10!>g # Conditional statement
|> d10>l  # (d)uplicate the top, push 10 on. If 10 > the old top, execute the `l`ess-than
          # case, which loops top-of-stack times.
|> d10!>g # Complement of the above, using the `g`reater-than to loop 10 times.

[]p # print a newline
  • 2 bytes saved by duplicating-saving instead of saving-loading

dc, 110 108 104 bytes

[[*]n]sd[dsi[li0!=dli1-dsi0!=L]dsLx]sl[10si[li0!=dli1-dsi0!=L]dsLx]sg[1+]sa10k/70*0k1~0!=ad10>ld10!>g[]p
echo 'v a (above)'|dc
# Wholly:
>> echo '163 2 [[*]n]sd[dsi[li0!=dli1-dsi0!=L]dsLx]sl[10si[li0!=dli1-dsi0!=L]dsLx]sg[1+]sa10k/70*0k1~0!=ad10>ld10!>g[]p'|dc
# outputs:
**
>> 
[[*]n]sd   # Here we store a macro in register d to print 1 * without a newline

[dsi[li0!=dli1-dsi0!=L]dsLx]sl # Store the "less than" case, a for loop which
                        # uses the top-of the stack as it's number of iterations.
[10si[li0!=dli1-dsi0!=L]dsLx]sg # Store the "greater than" case. It's the above,
                        # but it puts 10 on the stack to use instead.

[1+]sa # Store a macro to add 1 to whatever is the top-of-stack.


10k # Set precision at non-zero to allow decimal division

/70* # Divide the top two of the stack, v/a; multiply by 70 (`/700*10` == `/70`)
             # dc is postfix and stack-based, so operators come after operands.

0k1~0!=a     # This is a ceiling function.
|> 0k  # set precision to 0 to perform integer division
|> 1~  # push the quotient of integer division by 1, and then the remainder. (r is top)
|> 0!=a # If the top-of-stack (decimal part) is not 0, add 1 to the quotient

d10>ld10!>g # Conditional statement
|> d10>l  # (d)uplicate the top, push 10 on. If 10 > the old top, execute the `l`ess-than
          # case, which loops top-of-stack times.
|> d10!>g # Complement of the above, using the `g`reater-than to loop 10 times.

[]p # print a newline
  • 2 bytes saved by duplicating-saving instead of saving-loading
  • 4 bytes saved dividing by 70
Saved 2 bytes.
Source Link
Delioth
  • 221
  • 1
  • 5

dc, 110110 108 bytes

[[*]n]sd[dsi[li0!=dli1-dsi0!=L]sLlLx]sl[10si[li0=L]dsLx]sl[10si[li0!=dli1-dsi0!=L]sLlLx]sg[1+]sa10k=L]dsLx]sg[1+]sa10k/700/10*0k1~0!=ad10>ld10!>g[]p
echo 'v a (above)'|dc
# Wholly:
>> echo '163 2 [[*]n]sd[dsi[li0!=dli1-dsi0!=L]sLlLx]sl[10si[li0=L]dsLx]sl[10si[li0!=dli1-dsi0!=L]sLlLx]sg[1+]sa10k=L]dsLx]sg[1+]sa10k/700/10*0k1~0!=ad10>ld10!>g[]p'|dc
# outputs:
**
>> 
[[*]n]sd   # Here we store a macro in register d to print 1 * without a newline

[dsi[li0!=dli1-dsi0!=L]sLlLx]sl=L]dsLx]sl # Store the "less than" case, a for loop which
                        # uses the top-of the stack as it's number of iterations.
[10si[li0!=dli1-dsi0!=L]sLlLx]sg=L]dsLx]sg # Store the "greater than" case. It's the above,
                        # but it puts 10 on the stack to use instead.

[1+]sa # Store a macro to add 1 to whatever is the top-of-stack.


10k # Set precision at non-zero to allow decimal division

/ 700 / 10 * # Divide the top two of the stack, v/a; then divide by 700, and multiply by 10
             # dc is postfix and stack-based, so operators come after operands.

0k1~0!=a     # This is a ceiling function.
|> 0k  # set precision to 0 to perform integer division
|> 1~  # push the quotient of integer division by 1, and then the remainder. (r is top)
|> 0!=a # If the top-of-stack (decimal part) is not 0, add 1 to the quotient

d10>ld10!>g # Conditional statement
|> d10>l  # (d)uplicate the top, push 10 on. If 10 > the old top, execute the `l`ess-than
          # case, which loops top-of-stack times.
|> d10!>g # Complement of the above, using the `g`reater-than to loop 10 times.

[]p # print a newline
  • 2 bytes saved by duplicating-saving instead of saving-loading

dc, 110 bytes

[[*]n]sd[dsi[li0!=dli1-dsi0!=L]sLlLx]sl[10si[li0!=dli1-dsi0!=L]sLlLx]sg[1+]sa10k/700/10*0k1~0!=ad10>ld10!>g[]p
echo 'v a (above)'|dc
# Wholly:
>> echo '163 2 [[*]n]sd[dsi[li0!=dli1-dsi0!=L]sLlLx]sl[10si[li0!=dli1-dsi0!=L]sLlLx]sg[1+]sa10k/700/10*0k1~0!=ad10>ld10!>g[]p'|dc
# outputs:
**
>> 
[[*]n]sd   # Here we store a macro in register d to print 1 * without a newline

[dsi[li0!=dli1-dsi0!=L]sLlLx]sl # Store the "less than" case, a for loop which
                        # uses the top-of the stack as it's number of iterations.
[10si[li0!=dli1-dsi0!=L]sLlLx]sg # Store the "greater than" case. It's the above,
                        # but it puts 10 on the stack to use instead.

[1+]sa # Store a macro to add 1 to whatever is the top-of-stack.


10k # Set precision at non-zero to allow decimal division

/ 700 / 10 * # Divide the top two of the stack, v/a; then divide by 700, and multiply by 10
             # dc is postfix and stack-based, so operators come after operands.

0k1~0!=a     # This is a ceiling function.
|> 0k  # set precision to 0 to perform integer division
|> 1~  # push the quotient of integer division by 1, and then the remainder. (r is top)
|> 0!=a # If the top-of-stack (decimal part) is not 0, add 1 to the quotient

d10>ld10!>g # Conditional statement
|> d10>l  # (d)uplicate the top, push 10 on. If 10 > the old top, execute the `l`ess-than
          # case, which loops top-of-stack times.
|> d10!>g # Complement of the above, using the `g`reater-than to loop 10 times.

[]p # print a newline

dc, 110 108 bytes

[[*]n]sd[dsi[li0!=dli1-dsi0!=L]dsLx]sl[10si[li0!=dli1-dsi0!=L]dsLx]sg[1+]sa10k/700/10*0k1~0!=ad10>ld10!>g[]p
echo 'v a (above)'|dc
# Wholly:
>> echo '163 2 [[*]n]sd[dsi[li0!=dli1-dsi0!=L]dsLx]sl[10si[li0!=dli1-dsi0!=L]dsLx]sg[1+]sa10k/700/10*0k1~0!=ad10>ld10!>g[]p'|dc
# outputs:
**
>> 
[[*]n]sd   # Here we store a macro in register d to print 1 * without a newline

[dsi[li0!=dli1-dsi0!=L]dsLx]sl # Store the "less than" case, a for loop which
                        # uses the top-of the stack as it's number of iterations.
[10si[li0!=dli1-dsi0!=L]dsLx]sg # Store the "greater than" case. It's the above,
                        # but it puts 10 on the stack to use instead.

[1+]sa # Store a macro to add 1 to whatever is the top-of-stack.


10k # Set precision at non-zero to allow decimal division

/ 700 / 10 * # Divide the top two of the stack, v/a; then divide by 700, and multiply by 10
             # dc is postfix and stack-based, so operators come after operands.

0k1~0!=a     # This is a ceiling function.
|> 0k  # set precision to 0 to perform integer division
|> 1~  # push the quotient of integer division by 1, and then the remainder. (r is top)
|> 0!=a # If the top-of-stack (decimal part) is not 0, add 1 to the quotient

d10>ld10!>g # Conditional statement
|> d10>l  # (d)uplicate the top, push 10 on. If 10 > the old top, execute the `l`ess-than
          # case, which loops top-of-stack times.
|> d10!>g # Complement of the above, using the `g`reater-than to loop 10 times.

[]p # print a newline
  • 2 bytes saved by duplicating-saving instead of saving-loading
Source Link
Delioth
  • 221
  • 1
  • 5
Loading