g | x | w | all
Bytes Lang Time Link
051AWK250808T170503Zxrs
173Go231006T154032Zbigyihsu
nanVyxal HS231006T151222Zpacman25
061ink190329T181510ZSara J
062PowerShell181111T165635ZGMills
066Ruby190223T221205ZWill Cro
nanJavascript190221T143244ZCoert Gr
056Attache190222T171232ZConor O&
071C# Visual C# Interactive Compiler181124T191453Zdana
059PHP190201T211650ZOliver
030Japt190201T150532ZOliver
097Red181110T191741ZGalen Iv
070CJam181117T201906ZHelen
104Clojure181115T035218ZTheGreat
051Perl 5181113T223517ZXcali
029MathGolf181112T154644ZKevin Cr
076C gcc181112T223046Zgastropn
017Stax181112T201251Zrecursiv
068Python 2181112T200810ZTriggern
092APLNARS181111T175802Zuser5898
123C#181110T212658ZHatsuPoi
060Powershell181112T161752Zmazzy
124C181110T164704ZHatsuPoi
062PowerShell181112T150736ZAdmBorkB
061R181112T073731ZJ.Doe
095Python 3181112T133853Zglietz
084C gcc181111T165333ZDennis
084Python 2181110T163120ZElPedro
025Pyth181112T114438ZSok
02305AB1E181110T172148ZOkx
068Python 2181112T060540ZVedant K
091Java 8181111T033201ZNotBaal
078Python 2181111T172117Zlynn
065PHP181111T171457ZTitus
057JavaScript Node.js181110T150135Zl4m2
061Bash181111T153535ZJonah
053J181111T055513ZFrownyFr
225sfk181111T010802ZΟurous
100Clean181110T235534ZΟurous
103PHP181110T223403Zth3pirat
123Lua181110T214952ZDavid Wh
020Jelly181110T185232ZDennis
030Charcoal181110T200924ZNeil
145Batch181110T193832ZNeil
110D181110T192652ZAdalynn
048Perl 6181110T175238Znwellnho
077Haskell181110T152342ZLaikoni
060Python 2181110T163620Zovs
060perl E181110T161711Zuser7392

AWK, 51 bytes

{for(;100>$i=++i;i%3||$i="("$i")")i%4||$i="["i"]"}1

Attempt This Online!

Go, 173 bytes

import(."strings";."fmt")
func f(){S,F:=[]string{},Sprintf
for i:=1;i<100;i++{s:=F("%d",i)
if i%4<1{s=F("[%s]",s)}
if i%3<1{s=F("(%s)",s)}
S=append(S,s)}
Print(Join(S," "))}

Attempt This Online!

Prints the output to STDOUT.

Vyxal HS, 103 bitsv2, 12.875 bytes

ɽƛ4ḊßøB;ƛ⌊₃ßøb

Try it Online!

ink, 61 bytes

VAR j=0
-(i)~j="{i%4:{i}|[{i}]}"
{i%3:{j}|({j})} <>{i<99:->i}

Try it online!

Explanation

VAR j=0                       // Declare a variable called j.
-(i)~j="{i%4:{i}|[{i}]}"      // The i label keeps track of how many times it's been visited. Set j to that value, or that value surrounded by brackets, depending o nwhat it is.
{i%3:{j}|({j})} <>{i<99:->i}  // Print j or (j), depending on i. Use glue (<>) to not print a newline. Go back to the i label if it's been visited fewer than 99 times.

PowerShell, 98 82 74 67 63 62 bytes

A whopping -31 bytes thanks to @Veskah -5 bytes thanks to @ASCII-only

(1..99|%{(($a=($_,"[$_]")[!($_%4)]),"($a)")[!($_%3)]})-join' '

Try it online!

I'm still not quite sure what I've done here.

Ruby, 72 66 bytes

p [*1..99].map{|x|a=x
a="[#{x}]"if x%4<1
a="(#{a})"if x%3<1
a}*' '

Thanks to @jonathan-frech and @conor-obrien for additional trimming.

Javascript, 114 96 bytes

[...Array(99)].map(_=>['[4]','(3)'].reduce((a,r)=>n%r[1]<1?r.replace(r[1],a):a,++n),n=0).join` `

Try it Online!

Thanks to Conor O'Brien for helping me improve it :-)

Attache, 56 bytes

Echo@@({~Join^^S@_'Mask[4'3|_,["["'"]","("'")"]]}=>1:99)

Try it online!

Explanation

Echo@@({~Join^^S@_'Mask[4'3|_,["["'"]","("'")"]]}=>1:99)
       {                                        }=>1:99  over each number _, 1 to 99:
                        4'3|_                                check if 4 or 3 divide _
                   Mask[     ,["["'"]","("'")"]]             keep the respective brackets
             ^^S@_'                                          fold over this list (seed = S[_]):
        ~Join                                                joining elements by the iterator
Echo@@(                                                ) print strings separated by spaces

Alternatives

58 bytes: Echo@@({~Join^^S@_'Mask[[4,3]|_,["["'"]","("'")"]]}=>1:99)

59 bytes: Print@@({~Join^^S@_'Mask[[4,3]|_,["["'"]","("'")"]]}=>1:99)

76 bytes: Print@@(&/S@{Mask[1'3'4'12|_,Split@$"${_} (${_}) [${_}] ([${_}])"] }=>1:99)

C# (Visual C# Interactive Compiler), 71 bytes

int i;for(;i<99;)Write("{0:;;(}{1:;;[}{2}{1:;;]}{0:;;)} ",++i%3,i%4,i);

Try it online!

-9 bytes thanks to @ASCIIOnly!

Leveraging the semicolon (The ";" section separator) to create a custom format string.

PHP, 59 bytes

for(;$i<100;$s=++$i%4?$i:"[$i]")echo$i%3|!$s?$s:"($s)"," ";

Try it online!

Japt, 30 bytes

Lo1@=X%4?X:"[{X}]"X%3?U:"({U})

Try it online!

Red, 99 97 bytes

repeat n 99[a: b: c: d:""if n% 3 = 0[a:"("c:")"]if n% 4 = 0[b:"["d:"]"]prin rejoin[a b n d c" "]]

Try it online!

CJam, 70 bytes

99,:){X4%0={'[Xs']++}{X}?}fX]{Xs'[/_,(=']/0=i3%0={'(Xs')++}{X}?}fX]S*

Try it out online! (Permalink)


Explanation

99                                                                    Push 99 to stack
  ,                                                                   Make a 0..98 array
   :)                                                                 Increment every value in array
     {                   }fX                                          For X in array at top of stack
                        ?                                             If...
      X4%0=                                                           Condition: X mod 4 = 0
           {        }                                                 Is true, then:
            '[                                                        Push "["
              Xs                                                      Push X as a string
                ']                                                    Push "]"
                  ++                                                  Concatenate to "[X]"
                     { }                                              Is false, then:
                      X                                               Push X
                            ]                                         Capture all in an array
                             {                                 }fX    For X in array at top of stack
                                                              ?       If...
                              Xs                                      X as a string
                                '[/                                   Split by "["
                                   _,(=                               Take last element after split
                                       ']/                            Split by "]"
                                          0=                          Take first element after split
                                            i                         Top element as an integer
                              Xs'[/_,(=']/0=i                         The number X minus any brackets
                                             3%0=                     Condition: X mod 3 = 0
                                                 {        }           Is true, then:
                                                  '(                  Push "("
                                                    Xs                Push the original X as a string
                                                      ')              Push ")"
                                                        ++            Concatenate to "(X)"
                                                           { }        If false, then:
                                                            X         Push X
                                                                  ]   Capture all in an array
                                                                   S* Separate by a space

This does not output a trailing space.

Clojure, 104 bytes

(apply print(map #(do(def s(if(=(rem % 4)0)(str"["%"]")%))(if(=(rem % 3)0)(str"("s")")s))(range 1 100)))

Try it online!

Perl 5, 51 bytes

say map{$o=$_%4?$_:"[$_]";($_%3?$o:"($o)").$"}1..99

Try it online!

MathGolf, 41 40 34 29 bytes

♀({îû)(î+╫îa_'(\')ßyΓî34α÷ä§ 

NOTE: It has a trailing space

Only my second MathGolf answer..
-5 bytes thanks to @JoKing.

Try it online.

Explanation:

♀(             # Push 99 (100 decreased by 1)
  {            # Start a loop, which implicitly loops down to (and excluding) 0
   û)(         #  Push string ")("
      î+       #  Append the 1-indexed index
        ╫      #  Rotate the string once towards the right
   îa          #  Push the 1-indexed index of the loop, wrap in a list
   _           #  Duplicate it
    '(        '#  Push string "("
      \        #  Swap the top two items of the stack
       ')     '#  Push string ")"
         ßy    #  Wrap all three into a list, and join them
   Γ           #  Wrap all four into a list
               #  (We now have a list [N, "(N)", "[N]", "([N])"], where N is the index)
   î           #  Push the 1-indexed index of the loop
    34         #  Push 3 and 4 to the stack
      α        #  Wrap all three into a list
       ÷       #  Check for each if the index is divisible by it
               #  (resulting in either [0,0], [0,1], [1,0], or [1,1]
        ä      #  Convert from binary to integer
               #  (resulting in either 0, 1, 2, or 3
         §     #  Push the string at that index from the array
               #  Push a space
               # (After the loop, output the entire stack joined together implicitly)

C (gcc), 76 bytes

Surprisingly, this straight-forward solution was shorter than the "clever" ones I could come up with.

f(i){for(i=0;i++<99;)printf(i%3?i%4?"%d ":"[%d] ":i%4?"(%d) ":"([%d]) ",i);}

Try it online!

Stax, 19 17 bytes

ä┐r►U^îⁿ_╤▌,│☻£╡▬

Run and debug it

Python 2, 68 bytes

for i in range(1,100):print("(%s)","%s")[i%3>0]%("[%s]"%i,i)[i%4>0],

Try it online!

Ends with a trailing space.

APL(NARS), 46 chars, 92 bytes

{{0=3∣w:1⌽')(',⍵⋄⍵}{0=4∣w:1⌽'][',⍵⋄⍵}⍕w←⍵}¨⍳99

litte test:

  {{0=3∣w:1⌽')(',⍵⋄⍵}{0=4∣w:1⌽'][',⍵⋄⍵}⍕w←⍵}¨⍳14
1 2 (3) [4] 5 (6) 7 [8] (9) 10 11 ([12]) 13 14 

C#, 124 117 123 bytes

-5 bytes thanks to Kevin Cruijssen

x=>{for(int i=0;i++<99;)System.Console.Write((i%3<1?"(":"")+(i%4<1?"[":"")+i+(i%4<1?"]":"")+(i%3<1?")":"")+(i>98?"":" "));}

Test with :

Action<int> t = x=>{for(int i=0;i++<99;)System.Console.Write((i%3<1?"(":"")+(i%4<1?"[":"")+i+(i%4<1?"]":"")+(i%3<1?")":"")+(i>98?"":" "));}
t.Invoke(0);
Console.ReadKey();

Powershell, 60 bytes

"$(1..99|%{($_,"($_)","[$_]","([$_])")[!($_%3)+2*!($_%4)]})"

Explanation:

Less golfed Test script:

$f = {

$r = 1..99|%{
    ($_, "($_)", "[$_]", "([$_])") [!($_%3)+2*!($_%4)]
}
"$($r)"

}

$expected = '1 2 (3) [4] 5 (6) 7 [8] (9) 10 11 ([12]) 13 14 (15) [16] 17 (18) 19 [20] (21) 22 23 ([24]) 25 26 (27) [28] 29 (30) 31 [32] (33) 34 35 ([36]) 37 38 (39) [40] 41 (42) 43 [44] (45) 46 47 ([48]) 49 50 (51) [52] 53 (54) 55 [56] (57) 58 59 ([60]) 61 62 (63) [64] 65 (66) 67 [68] (69) 70 71 ([72]) 73 74 (75) [76] 77 (78) 79 [80] (81) 82 83 ([84]) 85 86 (87) [88] 89 (90) 91 [92] (93) 94 95 ([96]) 97 98 (99)'
$result = &$f
$result-eq$expected
$result

Output:

True
1 2 (3) [4] 5 (6) 7 [8] (9) 10 11 ([12]) 13 14 (15) [16] 17 (18) 19 [20] (21) 22 23 ([24]) 25 26 (27) [28] 29 (30) 31 [32] (33) 34 35 ([36]) 37 38 (39) [40] 41 (42) 43 [44] (45) 46 47 ([48]) 49 50 (51) [52] 53 (54) 55 [56] (57) 58 59 ([60]) 61 62 (63) [64] 65 (66) 67 [68] (69) 70 71 ([72]) 73 74 (75) [76] 77 (78) 79 [80] (81) 82 83 ([84]) 85 86 (87) [88] 89 (90) 91 [92] (93) 94 95 ([96]) 97 98 (99)

C, C++, 136 133 131 129 128 124 bytes

-5 bytes thanks to Zacharý and inspired by write() function in D language ( see Zacharý answer )

-2 bytes thanks to mriklojn

-12 bytes for the C version thanks to mriklojn

-4 bytes thanks to ceilingcat

#include<cstdio>
void f(){for(int i=0;i++<99;)printf("(%s%d%s%s%s"+!!(i%3),i%4?"":"[",i,i%4?"":"]",i%3?"":")",i%99?" ":"");}

C Specific Optimization : 115 bytes

#include<stdio.h>
i;f(){for(;i++<99;)printf("(%s%d%s%s%s"+!!(i%3),i%4?"":"[",i,i%4?"":"]",i%3?"":")",i%99?" ":"");}

PowerShell, 67 62 bytes

"$(1..99|%{'('*!($x=$_%3)+'['*!($y=$_%4)+$_+']'*!$y+')'*!$x})"

Try it online!

Basically a FizzBuzz using string multiplication times Boolean variables (implicitly cast to 1 or 0). Those strings are left on the pipeline and gathered within a script block inside quotes. Since the default $OutputFieldSeparator for an array is spaces, this implicitly gives us space-delimited array elements.

R, 61 bytes

"+"=c
r=""+""
cat(paste0(r+"(",r+""+"[",1:99,r+""+"]",r+")"))

Try it online!

Python 3, 95 bytes

print(*[(i if i%4else f"[{i}]")if i%3else(f"({i})"if i%4else f"([{i}])")for i in range(1,100)])

Try it online!

C (gcc), 84 bytes

main(i){while(99/i++)printf("%s%s%d%s%s ","("+i%3,"["+i%4,i-1,"]"+i%4,")"+i%3);}

There's a null byte at the beginning of each "bracket string".

Try it online!

Python 2, 105 97 88 86 85 84 bytes

x=1
while x<100:print((('%s','(%s)')[x%3<1],'[%s]')[x%4<1],'([%s])')[x%12<1]%x,;x+=1

Try it online!

Pyth, 25 bytes

jdmj]W!%d4dc2*"()"!%d3S99

Try it online here.

jdmj]W!%d4dc2*"()"!%d3S99   
  m                   S99   Map [1-99], as d, using:
                   %d3        d mod 3
                  !           Logical not, effectively maps 0 to 1, all else to 0
             *"()"            Repeat "()" the above number of times
           c2                 Chop into two equal parts - maps "()" to ["(",")"] , and "" to ["",""]
                                The above is result {1}
       %d4                    d mod 4
      !                       Logical not the above
    ]W    d                   If the above is truthy, [d], else d
                                The above is result {2}
   j                          Join {1} on string representation of {2}
jd                          Join the result of the map on spaces, implicit print

05AB1E, 23 bytes

-1 byte thanks to Kevin Cruijssen

тGND4Öi…[ÿ]}N3Öi…(ÿ)]ðý

Try it online!

Python 2, 68 bytes

i=0
exec"i+=1;t,f=i%3<1,i%4<1;print'('*t+'['*f+`i`+']'*f+')'*t,;"*99

Try it online!

Java 8, 92 91 bytes

-1 byte thanks to @Dana

i->{for(;i++<99;)out.printf((i>1?" ":"")+(i%12<1?"([%d])":i%3<1?"(%d)":i%4<1?"[%d]":i),i);}

Try it online!

Alternative solution, 82 bytes (with trailing space in the output - not sure if that's allowed):

i->{for(;i++<99;)out.printf((i%12<1?"([%d])":i%3<1?"(%d)":i%4<1?"[%d]":i)+" ",i);}

Explanation:

for(;i++<99;) - a for loop that goes from the value of i (reused as input, taken to be 0 in this case) to 99

out.printf(<part1>+<part2>,i); - formats the string before immediately printing it to stdout with the value of i

where <part1> is (i>1?" ":"") - prints the space before printing the number unless that number is 1, in which case it omits the space

and <part2> is (i%12<1?"([%d])":i%3<1?"(%d)":i%4<1?"[%d]":i) - if i is divisible by both 3 and 4, i has both square and round brackets around it; else if i is divisible by 3, i has round brackets; else if i is divisible by 4, i has square brackets; else, i has no brackets.

Python 2, 78 bytes

i=0
exec"i+=1;u=i%3/-2*(i%4/-3-1);print'([%0d])'[u:7-u:1+(i%3<1<=i%4)]%i,;"*99

Try it online!

I envisioned this cool approach slicing '([%0d])' but I can't get the expressions any shorter.

PHP, 65 bytes

while($i++<99)echo$i%4?$i%3?$i:"($i)":($i%3?"[$i]":"([$i])")," ";

or

while($i++<99)echo"("[$i%3],"["[$i%4],$i,"]"[$i%4],")"[$i%3]," ";

(requires PHP 5.5 or later)

Run with -nr or try them online.

JavaScript (Node.js), 57 bytes

f=(n=99)=>n&&f(n-1)+(s=n%4?n:`[${n}]`,n%3?s:`(${s})`)+' '

Try it online!

Changed to community cuz the optimize rely too much on it

Bash, 61 bytes

-14 bytes, thanks to Dennis

seq 99|awk '{ORS=" ";x=$1%4?$1:"["$1"]";print$1%3?x:"("x")"}'

explanation

Pretty straightforward:

Try it online!

J, 54 53 bytes

1 byte less thanks to @Jonah

(*stdout(3|.0=4 3 1 3 4&|,1=":)#3|.']) ([',":)@>i.100

Try it online!

sfk, 225 bytes

for n from 1 to 99 +calc -var #(n)/3+1/3 -dig=0 +calc -var #text*3-#(n) +setvar t +calc -var #(n)/4 -dig=0 +calc -var #text*4-#(n) +xed -var _0_#(t)\[#(n)\]_ _*_#(t)#(n)_ +xed _0*_([part2])_ _?*_[part2]_ +xed "_\n_ _" +endfor

Try it online!

Clean, 100 bytes

import StdEnv,Text

join" "[if(n/3*3<n)m("("+m+")")\\n<-[1..99],m<-[if(n/4*4<n)(""<+n)("["<+n<+"]")]]

Try it online!

PHP 103

for(;$i<1e2;$i++)$a.=$i%12==0?"([$i]) ":($i%3==0?"($i) ":($i%4==0?"[$i] ":"$i "));echo substr($a,5,-1);

https://www.ideone.com/SBAuWp

Lua, 161 123 bytes

b=""for i=1,99 do;c,d=i%3==0,i%4==0;b=b..(c and"("or"")..(d and"["or"")..i..(d and"]"or"")..(c and")"or"").." "end;print(b)

Try it online!

Ungolfed:

b = ""
for i = 1, 99 do
    c = 1 % 3 == 0
    d = 1 % 4 == 0
    a = ""
    if c then
        a = a .. "("
    end
    if d then
        a = a .. "["
    end
    a = a .. i
    if d then
        a = a .. "]"
    end
    if c then
        a = a .. ")"
    end
    b = b .. a .. " "
end
print(b)

Jelly, 21 20 bytes

³Ṗµ3,4ṚƬḍד([“])”j)K

Try it online!

How it works

³Ṗµ3,4ṚƬḍד([“])”j)K  Main link. No arguments.

³                     Set the return value to 100.
 Ṗ                    Pop; yield [1, ..., 99].
  µ               )   Map the chain in between over [1, ..., 9]; for each integer k:
   3,4                    Set the return value to [3, 4].
      ṚƬ                  Reverse until a loop is reached. Yields [[3, 4], [4, 3]].
        ḍ                 Test k for divisibility by [[3, 4], [4, 3]], yielding a
                          matrix of Booleans.
         ד([“])”         Repeat the characters of [['(', '['], [']', ')']] as many
                          times as the Booleans indicate.
                 j        Join the resulting pair of strings, separated by k.
                   K  Join the resulting array of strings, separated by spaces.

Charcoal, 30 bytes

⪫EEE⁹⁹I⊕ι⎇﹪⊕κ⁴ι⪫[]ι⎇﹪⊕κ³ι⪫()ι 

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

    ⁹⁹                          Literal 99
   E                            Map over implicit range
        ι                       Current value
       ⊕                        Incrementd
      I                         Cast to string
  E                             Map over list of strings
            κ                   Current index
           ⊕                    Incremented
             ⁴                  Literal 4
          ﹪                     Modulo
              ι                 Current value
                []              Literal string `[]`
                  ι             Current value
               ⪫                Join i.e wrap value in `[]`
         ⎇                      Ternary
 E                              Map over list of strings
                      κ         Current index
                     ⊕          Incremented
                       ³        Literal 3
                    ﹪           Modulo
                        ι       Current value
                          ()    Literal string `()`
                            ι   Current value
                         ⪫      Join i.e wrap value in `()`
                   ⎇            Ternary
                                Literal space
⪫                               Join list
                                Implicitly print

Batch, 145 bytes

@set s=
@for /l %%i in (1,1,99)do @set/an=%%i,b=n%%4,p=n%%3&call:c
@echo%s%
:c
@if %b%==0 set n=[%n%]
@if %p%==0 set n=(%n%)
@set s=%s% %n%

The code falls through into the subroutine but the string has already been printed by this point so the code executes harmlessly.

D, 110 bytes

import std.stdio;void f(){for(int i;i<99;)write(++i%3?"":"(",i%4?"":"[",i,i%4?"":"]",i%3?"":")",i%99?" ":"");}

Try it online!

Ported from @HatsuPointerKun's C++ answer.

Perl 6, 51 48 bytes

put {$_%3??$^a!!"($a)"}(++$_%4??$_!!"[$_]")xx 99

Try it online!

Haskell, 77 bytes

unwords[f"()"3$f"[]"4$show n|n<-[1..99],let f(x:r)m s|mod n m<1=x:s++r|1<3=s]

Try it online!

I wonder if show[n] can be used to shorten things up, so far to no avail.

Python 2, 68 65 60 bytes

i=0
exec"i+=1;print'('[i%3:]+`[i][i%4:]or i`+')'[i%3:],;"*99

Try it online!

perl -E, 60 bytes

$,=$";say map$_%12?$_%3?$_%4?$_:"[$_]":"($_)":"([$_])",1..99

Some bytes can be saved if we can use newlines between the numbers: in that case, we can remove the $,=$";, change the map into a for loop, while moving the say into the loop.