| Bytes | Lang | Time | Link |
|---|---|---|---|
| 032 | Wolfram Language Mathematica | 191113T015210Z | att |
| 020 | Husk | 201015T121615Z | LegionMa |
| nan | C gcc | 191112T222121Z | girobuz |
| 023 | Japt | 191113T194418Z | AZTECCO |
| 059 | Python 2 | 191112T105619Z | TFeld |
| 032 | K oK | 191113T102752Z | scrawl |
| 079 | Wren | 191113T041421Z | user8505 |
| 046 | R | 191112T174035Z | John |
| 055 | Python 2 | 191113T020810Z | xnor |
| 040 | Wolfram Language Mathematica | 191112T234454Z | Greg Mar |
| 038 | Julia 1.0 | 191112T161445Z | gggg |
| 053 | Ruby | 191112T151718Z | G B |
| 047 | Haskell | 191112T213924Z | Joseph S |
| 023 | Pyth | 191112T195634Z | frank |
| 058 | Icon | 191112T124610Z | Galen Iv |
| 084 | Forth gforth | 191112T182352Z | reffu |
| 054 | PowerShell | 191112T163405Z | Veskah |
| 016 | Jelly | 191112T132233Z | hyper-ne |
| 089 | Java 8 | 191112T144229Z | Kevin Cr |
| 015 | 05AB1E | 191112T124630Z | Kevin Cr |
| 062 | PHP | 191112T120605Z | Night2 |
| 023 | Charcoal | 191112T120643Z | Neil |
| 063 | JavaScript Node.js | 191112T110218Z | tsh |
C (gcc), 79 74 77 bytes
78 if the dash in compile arg is ignored. Port of TField answer. Increase in bytes is to comply with rules.
-5 bytes thanks to ceilingcat and bznein
b;c;f(a){for(b=0;++b<3;c=0)while(c<a/2)printf("%f ",pow(.03*a+1,c++)*b*300);}
Japt, 27 23 bytes
_+3/L*Z*U}h[300]Uz
cUmÑ
_+3/L*Z*U} // function returning next element
h[300]Uz // runs the above func. U/2 times, starting from 300
cU®Ñ // concat the array obtained with the array multiplied * 2
Saved 4 thanks to @Shaggy
Python 2, 61 60 59 bytes
lambda n:[a*(1+.03*n)**i*75for a in 4,8for i in range(n/2)]
-1 byte, thanks to Joseph Sible
Wren, 79 bytes
Fn.new{|n|
for(a in[300,600])for(i in 1..n/2){
System.print(a)
a=a+a*n*0.03
}
}
Wren, 81 bytes
TField answer turns out to be longer.
Fn.new{|n|
for(i in 0...n/2)for(a in[3,6])System.print(a*(1+0.03*n).pow(i)*100)
}
Python 2, 55 bytes
n=input()/2
for c in 4,8:exec"print c*75;c*=1+.06*n;"*n
The *75 trick is taken from other answers.
Wolfram Language (Mathematica), 40 bytes
Two independent 40-byte answers: the first is an unnamed function, the second is a named function g, both taking one argument.
Table[300i(1+.03#)^j,{i,2},{j,0,#/2-1}]&
g@n_:=300#(1+.03n)^(#2-1)&~Array~{2,n/2}
Julia 1.0, 42 38 bytes
f(n,z=[75*(1+.03n).^(0:n÷2-1)])=4z,8z
-4 bytes using ideas from John and Joseph Sible.
Pyth, 23 bytes
Fk2Fb/Q2*300*hk^h*.03Qb
Port of @TFeld's answer, which I was able to make decently concise. Cant help but feel like there's a more clever answer with Pyth but I wasnt able to find it.
How it Works
Fk2Fb/Q2*300*hk^h*.03Qb
Fk2 - For k in range(2)
Fb/Q2 - For b in range(input/2)
*300*hk - 300 times k+1 times...
h*.03Q - 1 + 0.03 times input
^ b - The above to the exponent b
Implicitly prints the result
Icon, 60 58 bytes
procedure f(n)
write(!36*(1+.03*n)^(0to n/2-1)*100)&\z
end
Saved 2 bytes by replacing (3|6)(alternate 3 with 6) with !36. !generates the components of a data object. When applied to a number it generates its digits. In Unicon - the descendent of Icon - !n generates the numbers in the range 1..n.
Forth (gforth), 84 bytes
: x dup 2/ 0 do fdup f. fover f* loop ; : f dup s>f .03e f* 1e f+ 3e2 x 6e2 fnip x ;
Code Explanation
\ helper function to extract out common logic from the small and large numbers
: x \ start a new word definition
dup 2/ \ duplicate the input and divide by 2
0 do \ loop from 0 to n/2
fdup f. \ print the top of the floating point stack
fover f* \ multiple the top float stack value by the 2nd float stack value
loop \ end the loop
;
: f \ start a new word definition
dup s>f \ duplicate n and place a copy on the float stack
0.03e f* \ multiple by 0.03 (multiply by 3 and divide by 100)
1e f+ \ add 1 to get our increase multiplier
3e2 x \ print the smaller numbers by starting with 300
6e2 fnip x \ drop the remaining small number and print the large numbers from 600
; \ end word definition
PowerShell, 66 54 bytes
-12 bytes thanks to mazzy
param($n)300,600|%{$y=$_;1..($n/2)|%{$y;$y*=1+$n*.03}}
Jelly, 16 bytes
×.03‘*HḶ$×300;Ḥ$
-2 bytes thanks to Nick Kennedy
Explanation
×.03‘*HḶ$×300;Ḥ$ Main Link
×.03 Multiply the number of bottles by 3%
‘ Increment (add 100%)
* (Vectorized) exponent to the power of:
HḶ$ [0, 1, ..., n-1]
×300 Multiply each factor by 300
;Ḥ$ Double the list and append it
Java 8, 89 bytes
n->{for(int k=0,i;++k<3;)for(i=0;i<n/2;)System.out.println(Math.pow(.03*n+1,i++)*k*300);}
Port of @TFeld's Python 2 answer, so make sure to upvote him.
Explanation:
n->{ // Method with integer parameter and no return-type
for(int k=0,i;++k<3;) // Loop `k` in the range (0,3) (basically [1,2]):
for(i=0;i<n/2;) // Inner loop `i` in the range [0, i/2):
System.out.println( // Print with trailing newline:
Math.pow(.03*n // `n` multiplied by 0.03
+1 // incremented by 1
,i++) // to the power `i`
*k*300);} // multiplied by `k` and 300
05AB1E, 15 bytes
₆v;F.03*>NmyтP,
Port of @TFeld's Python 2 answer, so make sure to upvote him.
Try it online or verify all test cases.
Explanation:
₆ # Push builtin integer 36
v # Loop `y` over both digits:
; # Halve the (implicit) input-integer
F # Inner loop `N` in the range [0, input/2):
.03* # Multiply the (implicit) input by 0.03
# (alternative 4-byter: `т/3*` # divide by 100, multiply by 3)
> # Increase this by 1
Nm # Take it to the power `N`
yт # Push both `y` and 100
P # And take the product of the entire stack
, # Then pop and print this number with trailing newline
PHP, 70 62 bytes
for($s=300;$i++<$n=$argn;$s=$n/2-$i?$s+$s*$n*.03:600)echo$s,_;
Output numbers are seperated by _.
Alternative for $s+$s*$n*.03 can be $s*=1+$n*.03 too, but both are same length.
Charcoal, 23 bytes
NθF²E⊘θI×׳⁰⁰⊕ιX⊕×θ·⁰³κ
Try it online! Link is to verbose version of code. Outputs each list element on a separate line. Explanation:
Nθ
Input n
F²
Loop i twice, once for the small sizes, once for the large sizes.
E⊘θ
Loop k over half of the number of bottles, and implicitly output each calculation on its own line.
I×׳⁰⁰⊕ιX⊕×θ·⁰³κ
Calculate 300(i+1)(.03n+1)ᵏ and cast the result to string.
JavaScript (Node.js), 63 bytes
f=(n,b=300,r=1+n*9/b,h=n/2)=>n?[b,...f(n-1,--h?b*r:600,r,h)]:[]