# Double-time is not double time

Based on this challenge.

In the rhythm game osu!, the difficulty modifier "Double-time" actually only increases the speed by 50%.

Your task, is to write a program that outputs a positive even integer (higher than 0), and when each byte/character (your choice which) in your source code is duplicated, it should output the number multiplied by 1.5.

For example if your source code is ABC and that outputs 6, then AABBCC should output 9.

Following the original challenge's rules:

## Rules

• You must build a full program.
• The initial source must be at least 1 byte long.
• Both the integers must be in base 10 (outputting them in any other base or with scientific notation is forbidden).
• Your program must not take input (or have an unused, empty input) and must not throw any error (compiler warnings are not considered errors).
• Outputting the integers with trailing / leading spaces is allowed.
• You may not assume a newline between copies of your source.
• This is , so the fewest bytes in each language wins!
• Default Loopholes apply.

I imagine this will be far less trivial than the original challenge, but hopefully we'll see some creative and unique answers!

• @Fatalize write a program that outputs a positive even integer Yes it will. Every even number can be multiplied by 1.5 to result in a whole integer – Skidsdev Jul 17 '17 at 8:28
• It seems like a dupe to me. – Erik the Outgolfer Jul 17 '17 at 8:35
• @EriktheOutgolfer Very similar but I'm sure this one is going to be a lot harder (unless I'm missing something obvious). – TheLethalCoder Jul 17 '17 at 8:37
• Duplicating characters may make trivial languages unrunnable. I wonder if there is a solution in a not single-character-command-styled or expression-based language. – Keyu Gan Jul 17 '17 at 10:35
• @TheLethalCoder Maybe the biggest obstacle is full program. It is hard to imagine a duplicated program still have a valid entry point / function. – Keyu Gan Jul 17 '17 at 14:52

# Pylons, 75 4 bytes

Picked a random language on TIO used it

46vt


Explanation:

Try it Online!

46    # Stack is [4, 6]

v     # Reverse the stack [6, 4]

t     # take top of stack 4


Doubled:

4466   # Stack is [4, 4, 6, 6]

vv     # Reverse the stack twice so it's the same [4, 4, 6, 6]

tt     # take top of stack 6 and again which is 6 again


Saved 2 bytes thanks to officialaimm

Saved 1 bytes thanks to Veedrac

• Hey, 4/6vt works as well... – officialaimm Jul 17 '17 at 11:25
• I wholeheartedly approve of the strategy of picking a random TIO language and learning it for a challenge – Skidsdev Jul 17 '17 at 11:25
• @officialaimm you are right, thanks. – LiefdeWen Jul 17 '17 at 11:28
• 4/6 <- 4 divided by nothing -> 4 ; and then 6. 44//66 <- 4 divided by 4 -> 1 ; nothing divided by nothing -> nothing ; and then 6 and 6. Maybe. Well done though. – V. Courtois Jul 17 '17 at 12:12
• Wouldn't 46vt do the same? – Veedrac Jul 17 '17 at 17:20

# Jelly, 2 bytes

!‘


Try it online!

Explanation:

!‘ Implicit 0
!  Factorial
‘ Increment


Doubled version:

!!‘‘


Try it online!

Explanation:

!!‘‘ Implicit 0
!    Factorial
!   Factorial
‘  Increment
‘ Increment

• If you do it a third time it goes from 3 -> 4, not 3->4.5?? – tuskiomi Jul 17 '17 at 16:19
• @tuskiomi No because it's not expected to do so. – Erik the Outgolfer Jul 17 '17 at 16:21

# LibreOffice Calc, 8 bytes

=A2+3
19


Save it as *.csv and open it in LibreOffice Calc. You will get 22 in A1.

Double them:

==AA22++33

1199


You will get 33 in A1

• clever language choice! – Giuseppe Jul 18 '17 at 2:34

# MATL, 3 bytes

TnQ


### Explanation

In MATL a scalar value (number, char, logical value) is the same as a 1×1 array containing that value.

Normal version:

T    % Push true
n    % Number of elements of true: gives 1
Q    % Add 1: gives 2


Doubled version:

TT   % Push [true, true]
n    % Number of elements of [true, true]: gives 2
n    % Number of elements of 2: gives 1
Q    % Add 1: gives 2
Q    % Add 1: gives 3

• TnQ for the answer... :D [We sometimes use tnq as a short-form for thank-you] – officialaimm Jul 17 '17 at 11:30
• @officialaimm :) [we sometimes use that to get the first n elements from an array...] – Luis Mendo Jul 17 '17 at 13:39

## vim, 5

i1<esc>X<C-a>


Without doubling:

i1<esc>  insert the literal text "1"
X        delete backwards - a no-op, since there's only one character
<C-a>    increment, giving 2


With doubling:

ii11<esc>   insert the literal text "i11"
<esc>       escape in normal mode does nothing
XX          since the cursor is on the last character, delete "i1"
<C-a><C-a>  increment twice, giving 3


Not sure if this answer is valid. Just post here in case some one may got ideas from here.

# Node.js with -p flag, 7 bytes

By Alex Varga:

3/3*22

33//33**2222


# Node.js with -p flag, 11 bytes

Old one:

3*2*0/1+22

33**22**00//11++2222


Output 22 and 33.

• How is it supposed to do 33? TIO doesn't seem able to do it. It locks on 00. – V. Courtois Jul 17 '17 at 12:07
• How about: 3/3*22 – Alex Varga Jul 17 '17 at 21:21
• @AlexVarga so sweet. – tsh Jul 18 '17 at 1:17
• @V.Courtois you are using strict mode – tsh Jul 18 '17 at 1:18
• @EdmundReed need -p flag to output expression value – tsh Jul 18 '17 at 5:29

# Python 2 REPL, 11 bytes

(3/1)*(2/1)


This simply evaluates to 3*2=6. Duplicated, it is

((33//11))**((22//11))


which evaluates to 3**2, which is 3 to the power of 2, or 9.

• Welcome to the site. This python does not produce any output and thus is not a valid answer. However if you change your answer to be a Python REPL, this does produce output and thus is a valid answer. You will either have to delete this answer or change the language from python 2 to python 2 repl. – Post Rock Garf Hunter Jul 18 '17 at 3:57
• @WheatWizard Thanks, and thanks for helping! Did I do this properly? – Carl Schildkraut Jul 18 '17 at 21:16

# APL, 7 bytes

⊃⍕⌊3×⍟2


Prints 2.

⊃⊃⍕⍕⌊⌊33××⍟⍟22


Prints 3.

Try it online!

### Waaat?

Single:

3×⍟2         → 2.079441542  ⍝  3 * ln 2
⌊2.079441542 → 2            ⍝  floor
⊃⍕           → '2'          ⍝  format and take first character


Double:

⍟⍟22          → 1.128508398  ⍝  ln ln 22
×1.128508398  → 1            ⍝ signum
33×1          → 33           ⍝  33 * 1
⌊⌊33          → 33           ⍝  floor
⊃⊃⍕⍕          → '3'          ⍝  format and take first character

• Could you please align the comments vertically? Or do we have different settings or something causing it on my end to loop like this? – Kevin Cruijssen Jul 17 '17 at 11:44
• @KevinCruijssen I think that's your browser font, but browsers doesn't render APL as monospaced anyways. that mine prntscr.com/fwp0l0 – Uriel Jul 17 '17 at 11:47
• Ah well, it's still readable and a great answer regardless. :) – Kevin Cruijssen Jul 17 '17 at 12:00
• It renders as monospace for me. Probably just depends on the font (prnt.sc/fwrnz1). The comments are definitely not aligned though :P – 2xsaiko Jul 17 '17 at 15:02
• @therealfarfetchd thanks, I've updated the last 3 rows – Uriel Jul 17 '17 at 15:13

# Actually, 3 bytes

1u*


Try it online!

Explanation:

1u* Errors are ignored
1   Push 1
u  Increment
* Multiply


Doubled version:

11uu**


Try it online!

Explanation:

11uu** Errors are ignored
1      Push 1
1     Push 1
u    Increment
u   Increment
*  Multiply
* Multiply


# CJam, 4 bytes

],))


Try it normally!

Try it doubled!

### Explanation

Normal:

]     e# Wrap the stack in an array: []
,    e# Get its length: 0
))  e# Increment twice: 2


Double:

]         e# Wrap the stack in an array: []
]        e# Wrap the stack in an array: [[]]
,       e# Get its length: 1
,      e# Get the range from 0 to n-1: [0]
)     e# Pull out its last element: 0
)))  e# Increment 3 times: 3

• The overloads are tricky...;) – Erik the Outgolfer Jul 17 '17 at 16:41
• AB], also works. – geokavel Jul 17 '17 at 17:03

# 05AB1E, 2 bytes

X>


Try it online!

Explanation:

X> Only top of stack is printed
X  Push X (default 1)
> Increment


Doubled version:

XX>>


Try it online!

Explanation:

XX>> Only top of stack is printed
X    Push X (default 1)
X   Push X (default 1)
>  Increment
> Increment


# Neim, 2 bytes

𝐓>


Try it online!

Explanation:

𝐓> Implicit 0
𝐓  Factorial
> Increment


Doubled version:

𝐓𝐓>>


Try it online!

𝐓𝐓>> Implicit 0
𝐓    Factorial
𝐓   Factorial
>  Increment
> Increment

• 4 out of the 5 answers... you're really going for it on this one! – TheLethalCoder Jul 17 '17 at 9:30
• @TheLethalCoder At least it's not 15 yet. ;) – Erik the Outgolfer Jul 17 '17 at 9:32

# Pyth, 3 bytes

he1


Try it here.

Explanation:

he1
h   Increment
e   Last digit
1   1


Doubled version:

hhee11


Try it here.

Explanation:

hhee11
h      Increment
h      Increment
e      Last digit
e      Last digit
11     11

• one he11 of an answer – Uriel Jul 17 '17 at 14:33

# R, 11 bytes

8*(!0)+1*!1


Try it online!

! is negation, and ** is exponentiation (an alias for ^). Numerics get converted to booleans: 0 to FALSE, all others to TRUE. Booleans get converted to integers: FALSE to 0, TRUE to 1, so !0==1, !1==0, !!00==0 and !!11==1.

The single version thus computes $$\8\times 1 + 1\times 0=8\$$, and the double version computes $$\88^0+11^1=12\$$.

• I was just trying to come up with a solution relying on * and **, but you beat me to it! – Giuseppe Sep 10 '19 at 19:37
• @Giuseppe I'm not convinced my solution is optimal (the need for brackets around !0 is annoying). There might be something shorter with - and *, but I haven't found such a solution yet... – Robin Ryder Sep 10 '19 at 21:22

# Cubix, 6 bytes

O.1)W@


Prints 2.

  O
. 1 ) W
@


Pushes 1, ) increments, W jumps left to O which outputs 2, and @ finishes the program.

Doubled up, it's obviously OO..11))WW@@, which on a cube is:

    O O
. .
1 1 ) ) W W @ @
. . . . . . . .
. .
. .


It pushes 1 twice, ) increments twice, W jumps left again, which puts it at the right-hand O heading north, which outputs 3, and then the next command is @ which terminates the program.

Try it online!

Doubled online!

# Klein, 8 6 bytes

/3+@4\


## Explanation

For the single the program follows a pretty straightforward path. The first mirror deflects it into the second which deflects it through the 4 to the end of the program.

The double is a little more complex. Here it is:

//33++@@44\\


The first two mirrors work the same, however there is a new mirror due to the doubling which deflects the ip back to the beginning, it is caught by the duplicate of the first mirror and deflected towards the end. All that is run is the 33++ which evaluates to 6.

# TI-Basic, 3 bytes

Single:

int(√(8


The last expression is implicitly returned/printed in TI-Basic, so this prints 2

Doubled:

int(int(√(√(88


Returns/prints 3

TI-Basic is a tokenized language; int(, √(, and 8 are each one byte in memory.

• Technically the challenge spec explicitly states when each character is doubled, but I'll allow this and update the spec – Skidsdev Jul 18 '17 at 15:48

# Ruby REPL, 8 bytes

";3#";22


The REPL only prints the last value evaluated: 22.

Doubled:

"";;33##"";;22


This time 33 is the last value evaluated. The string is discarded once again, and a # starts a comment.

# ><>, 19 8 Bytes

32b*!{n;


Prints 22
Try it online!

Explanation:

32b   push literals onto the stack: [3,2,11]
*     multiply the top two values: [3,22]
!     skip the next instruction
{     (skipped)
n     pop and print the top value from the stack (22)
;     end execution


### Doubled:

3322bb**!!{{nn;;


Prints 33
Try it online!

Explanation:

3322bb push literals onto the stack: [3,3,2,2,11,11]
**     multiply top values (twice): [3,3,2,242]
!      skip next instruction
!      (skipped)
{{     rotate the stack to the left (twice): [2,242,3,3]
nn     pop and print the top two values from the stack (33)
;      end execution


Old Version:
Normal:

11+!vn;
n
;


Prints 2
Try it online!

Explanation:

1    push 1 on the stack: [1]
1    push 1 on the stack: [1,1]
+    add top two values of the stack: [2]
!    skip the next instruction
v    (skipped)
n    print the top value of the stack (2)
;    end execution


Doubled:

1111++!!vvnn;;
nn
;;


Prints 3
Try it online!

Explanation:

1111    push four 1's on the stack: [1,1,1,1]
+    add top two values of the stack: [1,1,2]
+    add top two values of the stack: [1,3]
!    skip the next instruction
!    (skipped)
v    change direction of execution (down)
n    print the top value of the stack (3)
;    end execution


• I think you're supposed to duplicate the newlines too. – Erik the Outgolfer Jul 17 '17 at 16:37
• @EriktheOutgolfer There aren't newlines anymore. – KSmarts Sep 28 '17 at 18:02

# Zsh, 14 bytes

<:|echo 22
3
:


Try it online!

Getting a full program in a non-golfing language to print anything with source code duplicated like this is a challenge. Zsh is very useful for this, because files and heredocs are implicitly passed to cat. Let's take a look at the first line in both cases:

<:|echo 22            # Give the file : on stdin to cat. cat pipes to 'echo 22', which ignores stdin
<<::||eecchhoo  2222  # Start heredoc on following lines with EOF string '::', pass to cat.
# Since cat exits 0, 'eecchhoo 2222' is not executed


So long as 3 is not a program, the first program will only print 22. The second program will print 33 surrounded by extra newlines (due to the duplication).

If 3 is a function/program/alias, then this 18 byte solution will still work!

<:|echo 22\\c\
3
:


Try it online!

The last \ is line continuation, so the newline is discarded, effectively making the echo statement echo '22\c3'. The \c causes echo to stop printing after 22 (which also happens to suppress the newline).

# Perl 6, 14 bytes

'|d 3#';say 22


This uses the conveniently named debug function dd to output the doubled program to STDERR. To separate the logic we encase the doubled program in quotes, which then cancel each other out when doubled, along with a comment character # to comment out the now invalid normal program.

# Stax, 3 bytes

UJ^


Run and debug it

Run and debug the doubled one

U pushes -1. J squares. ^ increments.

# MathGolf, 2 bytes

▬)


Similar to other answers in that the first instruction produces a 1 even when doubled and the second increments it. In this case, I've used reverse exponentiation (0**0 = 0**0**0 = 1) but it also could have been any of the !£≤° instruction and perhaps even more that I missed.

# Japt, 2 bytes

Another "factorial+1" solution.

ÊÄ


Test it

ÊÊÄÄ


Test it