g | x | w | all
Bytes Lang Time Link
147Swift 6250702T190029ZmacOSist
008Vyxal 3250702T132104ZThemooni
121dc170217T044110ZR. Kap
085stacked170216T020853ZConor O&
331Java170212T160255ZAddison
099PHP170212T145024ZTitus
097JavaScript ES6170212T124228ZYytsi
194C++170206T184226ZDavid Co
090JavaScript ES6170206T160458ZArnauld
098Python 2170206T152832ZRod
02805AB1E170206T151904ZEmigna

Swift 6, 147 bytes

Meets the original challenge criteria, including stdin/stdout and string parsing.

let p=readLine()!.split{$0<"!"}
for n in 1...Int(p.last!)!{let f=(0..<Int(p[0])!).map{n%Int(p[$0*2+1])!<1 ?p[$0*2+2]:""}.joined()
print(f>"" ?f:n)}

Try it on SwiftFiddle!

Vyxal 3, 8 bytes

ƛ?≛?•∨?_

Taking liberties with the io format given the age of this challenge.

Inputs are:

  1. Number of iterations

  2. List of divisors

  3. List of strings

Vyxal It Online!

ƛ?≛?•∨?_­⁡​‎‎⁡⁠⁡‏‏​⁡⁠⁡‌⁢​‎‎⁡⁠⁢‏⁠‎⁡⁠⁣‏‏​⁡⁠⁡‌⁣​‎‎⁡⁠⁤‏⁠‎⁡⁠⁢⁡‏‏​⁡⁠⁡‌⁤​‎‎⁡⁠⁢⁢‏‏​⁡⁠⁡‌⁢⁡​‎‎⁡⁠⁢⁣‏⁠‎⁡⁠⁢⁤‏‏​⁡⁠⁡‌­
ƛ         # ‎⁡map over 1..implicit first input (number of iterations)
 ?≛       # ‎⁢for each divisor in the second input, does it divide n?
          # ‎⁢result is a bit mask of numbers that do
   ?•     # ‎⁣multiply the bit mask with the strings, and concatenate
     ∨    # ‎⁤if the result is an empty string, output n instead
      ?_  # ‎⁢⁡cycle inputs for the next loop
💎

Created with the help of Luminespire.

<script type="vyxal3">
ƛ?≛?•∨?_
</script>
<script>
 args=[["10","[2,3,5]","[\"Fizz\",\"Buzz\",\"Crackle\"]"],["10","[3,2,5]","[\"Buzz\",\"Fizz\",\"Crackle\"]"]]
</script>
<script src="https://themoonisacheese.github.io/snippeterpreter/snippet.js" type="module"/>

dc, 121 bytes

?dstsw?[rdlt:Y:Rlt1-dst0<q]dsqx?sb1sm[ln;Y;RnlP1+sP]ss[lmn]sF[1sn0sP[lnd;Ylmr%0=s1+dsnlw!<g]dsgxlP0=Flm1+dsm10Plb!<i]dsix

Takes input on 3 separate lines, the first line containing the integer n, the second housing the int str tuples with the strings enclosed in square brackets ([]), and the third line consists of the integer k. For example, 3 2 Fizz 3 Buzz 5 Crackle 10 could be input as:

3
3 [Buzz] 2 [Fizz] 5 [Crackle]
10

Try it online!

Or taking input in a different order:

dc, 118 bytes

?dstsw[dlt:Y:Rlt1-dst0<q]dsqxsb1sm[ln;Y;RnlP1+sP]ss[lmn]sF[1sn0sP[lnd;Ylmr%0=s1+dsnlw!<g]dsgxlP0=Flm1+dsm10Plb!<i]dsix

This takes input in a different order, but on a single line in the format

k [str1] int1 [str2] int2 (...) [strn] intn n

For example, 3 2 Fizz 3 Buzz 5 Crackle 10 would be input as:

10 [Buzz] 3 [Fizz] 2 [Crackle] 5 3

Try it online!

stacked, 85 bytes

args rev...2*nsgroup rev 2 chunk@s~>{!s[1#]map s[0#n|]map keep''join:[n]\¬if out}map

Try it online! Alternatively, 86 bytes:

args behead...@k sgroup 2 chunk@s k~>{!s[1#]map s[0#n|]map keep''join:[n]\¬if out}map

Java, 331 bytes

Because Java.

import java.util.*;class A{A(int c,String x){i=c;v=x;}int i;String v;void x(String[]x){ArrayList<A>l=new ArrayList();int n=0;for(;++n<x.length-1;)l.add(new A(Integer.valueOf(x[n++]),x[n]));n=Integer.valueOf(x[n]);for(int i=1;i++<n;){String o="";boolean y=1>0;for(A a:l)if(i%a.i==0){y=1<0;o+=a.v;}if(y)o+=i;System.out.println(o);}}}

This is the full class required for this. However, in order to run it, you must call the method x on an existing instance of A. For the sake of testing, I have provided a command-line runnable class below, which is partially ungolfed.

import java.util.*;
class A{
A(int c,String x){i=c;v=x;}
int i;
String v;
void x(String[]x){
ArrayList<A>l=new ArrayList();
int n=0;
for(;++n<x.length-1;)
l.add(new A(Integer.valueOf(x[n++]),x[n]));
n=Integer.valueOf(x[n]);
for(int i=1;i++<n;){
String o="";
boolean y=1>0;
for(A a:l)if(i%a.i==0){y=1<0;o+=a.v;}
if(y)o+=i;
System.out.println(o);
}
}
public static void main(String[] args) {
new A(0,"").x(args);
}
}

PHP, 99 bytes

Based on primo´s FizzBuzz answer: õ is chr(245), a bit inverted newline.

for(;$i++<($a=$argv)[$z=$argc-1];){for($k=$s="";$z>$k+=2;)$s.=[$a[$k+1]][$i%$a[$k]];echo$s?:$i,~õ;}

ignores the first argument; run with -nr.

JavaScript (ES6), 105 97 bytes

g=(m,k,i=1)=>i<-~k?([...m.keys()].filter(j=>i%j<1).map(j=>m.get(j)).join``||i)+"\n"+g(m,k,i+1):""

Takes in a map of pairs m (integer, string) and an integer k. Comes with a trailing newline.

Here's a non-recursive version (105 bytes), but doesn't yield a trailing newline.

m=>k=>[...Array(k).keys()].map(x=>[...m.keys()].filter(j=>-~x%j<1).map(j=>m.get(j)).join``||x+1).join`\n`

Try it online!

C++, 194 bytes

#include <iostream>
#define p std::cout<<
int main(int c,char**a){c=2*atoi(a[1])+2;int x,f,i,n=atoi(a[c]);for(x=1;x<=n;x++){f=0;for(i=2;i<c;i+=2)if(x%atoi(a[i])<1)f=1,p a[i+1];if(!f)p x;p'\n';}}

Ungolfed:

#include <iostream>

int main(int c, char **a) {
    c = 2 * atoi(a[1]) + 2;
    int x, f, i, n = atoi(a[c]);
    for (x = 1; x <= n; x++) {
        f = 0;
        for (i = 2; i < c; i += 2)
            if (x % atoi(a[i]) < 1) f = 1, std::cout << a[i+1];
        if (!f) std::cout << x;
        std::cout << '\n';
    }
}

JavaScript (ES6), 90 bytes

Generates a leading newline.

f=(a,i=a.pop())=>i?f(a,i-1)+`
`+(a.map((_,j)=>++j>a[0]|i%a[j*2-1]?'':a[j*2]).join``||i):''

Test

f=(a,i=a.pop())=>i?f(a,i-1)+`
`+(a.map((_,j)=>++j>a[0]|i%a[j*2-1]?'':a[j*2]).join``||i):''

console.log(f([3, 2, 'Fizz', 3, 'Buzz', 5, 'Crackle', 10]))
console.log(f([3, 3, 'Buzz', 2, 'Fizz', 5, 'Crackle', 10]))

Python 2, 98 bytes

lambda b:[''.join(''if x%b[1+i*2]else b[2+i*2]for i in range(b[0]))or`x`for x in range(1,b[-1]+1)]

Try it online!

05AB1E, 28 bytes

#¦¤U¨2ôøVXLvY`sysÖÏJDg1‹iy},

Try it online!

Or with a different input format:

05AB1E, 16 bytes

Lv²y³ÖÏJDg1‹iy},

Try it online!