Skip to main content
Became Hot Network Question
Tweeted twitter.com/StackCodeGolf/status/1581842627108147201
added 11 characters in body
Source Link
Bubbler
  • 78.4k
  • 5
  • 149
  • 469

From the infinite triangular array of positive integers, suppose we select every 2nd numbers on every 2nd row as shown below:

$$ \underline{1} \\ \;2\; \quad \;3\; \\ \;\underline{4}\; \quad \;5\; \quad \;\underline{6}\; \\ \;7\; \quad \;8\; \quad \;9\; \quad 10 \\ \underline{11} \quad 12 \quad \underline{13} \quad 14 \quad \underline{15} \\ 16 \quad 17 \quad 18 \quad 19 \quad 20 \quad 21 \\ \underline{22} \quad 23 \quad \underline{24} \quad 25 \quad \underline{26} \quad 27 \quad \underline{28} \\ \cdots $$

The resulting sequence (A185868) is as follows:

1, 4, 6, 11, 13, 15, 22, 24, 26, 28, 37, 39, 41, 43, 45, 56, 58, 60, 62, 64, 66,
79, 81, 83, 85, 87, 89, 91, 106, 108, 110, 112, 114, 116, 118, 120, 137, ...

The task is to output this sequence.

I/O rules apply. You can choose to implement one of the following:

  • Given the index \$n\$ (0- or 1-based), output the \$n\$th term of the sequence.
  • Given a positive integer \$n\$, output the first \$n\$ terms of the sequence.
  • Take no input and output the entire sequence by
    • printing infinitely or
    • returning a lazy list or a generator.

Standard rules apply. The shortest code in bytes wins.

From the infinite triangular array of positive integers, select every 2nd numbers on every 2nd row as shown below:

$$ \underline{1} \\ \;2\; \quad \;3\; \\ \;\underline{4}\; \quad \;5\; \quad \;\underline{6}\; \\ \;7\; \quad \;8\; \quad \;9\; \quad 10 \\ \underline{11} \quad 12 \quad \underline{13} \quad 14 \quad \underline{15} \\ 16 \quad 17 \quad 18 \quad 19 \quad 20 \quad 21 \\ \underline{22} \quad 23 \quad \underline{24} \quad 25 \quad \underline{26} \quad 27 \quad \underline{28} \\ \cdots $$

The resulting sequence (A185868) is as follows:

1, 4, 6, 11, 13, 15, 22, 24, 26, 28, 37, 39, 41, 43, 45, 56, 58, 60, 62, 64, 66,
79, 81, 83, 85, 87, 89, 91, 106, 108, 110, 112, 114, 116, 118, 120, 137, ...

The task is to output this sequence.

I/O rules apply. You can choose to implement one of the following:

  • Given the index \$n\$ (0- or 1-based), output the \$n\$th term of the sequence.
  • Given a positive integer \$n\$, output the first \$n\$ terms of the sequence.
  • Take no input and output the entire sequence by
    • printing infinitely or
    • returning a lazy list or a generator.

Standard rules apply. The shortest code in bytes wins.

From the infinite triangular array of positive integers, suppose we select every 2nd numbers on every 2nd row as shown below:

$$ \underline{1} \\ \;2\; \quad \;3\; \\ \;\underline{4}\; \quad \;5\; \quad \;\underline{6}\; \\ \;7\; \quad \;8\; \quad \;9\; \quad 10 \\ \underline{11} \quad 12 \quad \underline{13} \quad 14 \quad \underline{15} \\ 16 \quad 17 \quad 18 \quad 19 \quad 20 \quad 21 \\ \underline{22} \quad 23 \quad \underline{24} \quad 25 \quad \underline{26} \quad 27 \quad \underline{28} \\ \cdots $$

The resulting sequence (A185868) is as follows:

1, 4, 6, 11, 13, 15, 22, 24, 26, 28, 37, 39, 41, 43, 45, 56, 58, 60, 62, 64, 66,
79, 81, 83, 85, 87, 89, 91, 106, 108, 110, 112, 114, 116, 118, 120, 137, ...

The task is to output this sequence.

I/O rules apply. You can choose to implement one of the following:

  • Given the index \$n\$ (0- or 1-based), output the \$n\$th term of the sequence.
  • Given a positive integer \$n\$, output the first \$n\$ terms of the sequence.
  • Take no input and output the entire sequence by
    • printing infinitely or
    • returning a lazy list or a generator.

Standard rules apply. The shortest code in bytes wins.

added 11 characters in body
Source Link
Bubbler
  • 78.4k
  • 5
  • 149
  • 469

GivenFrom the infinite triangular array of positive integers, select every 2nd numbers on every 2nd row. as shown below:

$$ \underline{1} \\ \;2\; \quad \;3\; \\ \;\underline{4}\; \quad \;5\; \quad \;\underline{6}\; \\ \;7\; \quad \;8\; \quad \;9\; \quad 10 \\ \underline{11} \quad 12 \quad \underline{13} \quad 14 \quad \underline{15} \\ 16 \quad 17 \quad 18 \quad 19 \quad 20 \quad 21 \\ \underline{22} \quad 23 \quad \underline{24} \quad 25 \quad \underline{26} \quad 27 \quad \underline{28} \\ \cdots $$

The resulting sequence (A185868) is as follows:

1, 4, 6, 11, 13, 15, 22, 24, 26, 28, 37, 39, 41, 43, 45, 56, 58, 60, 62, 64, 66,
79, 81, 83, 85, 87, 89, 91, 106, 108, 110, 112, 114, 116, 118, 120, 137, ...

The task is to output this sequence.

I/O rules apply. You can choose to implement one of the following:

  • Given the index \$n\$ (0- or 1-based), output the \$n\$th term of the sequence.
  • Given a positive integer \$n\$, output the first \$n\$ terms of the sequence.
  • Take no input and output the entire sequence by
    • printing infinitely or
    • returning a lazy list or a generator.

Standard rules apply. The shortest code in bytes wins.

Given the infinite triangular array of positive integers, select every 2nd numbers on every 2nd row.

$$ \underline{1} \\ \;2\; \quad \;3\; \\ \;\underline{4}\; \quad \;5\; \quad \;\underline{6}\; \\ \;7\; \quad \;8\; \quad \;9\; \quad 10 \\ \underline{11} \quad 12 \quad \underline{13} \quad 14 \quad \underline{15} \\ 16 \quad 17 \quad 18 \quad 19 \quad 20 \quad 21 \\ \underline{22} \quad 23 \quad \underline{24} \quad 25 \quad \underline{26} \quad 27 \quad \underline{28} \\ \cdots $$

The resulting sequence (A185868) is as follows:

1, 4, 6, 11, 13, 15, 22, 24, 26, 28, 37, 39, 41, 43, 45, 56, 58, 60, 62, 64, 66,
79, 81, 83, 85, 87, 89, 91, 106, 108, 110, 112, 114, 116, 118, 120, 137, ...

I/O rules apply. You can choose to implement one of the following:

  • Given the index \$n\$ (0- or 1-based), output the \$n\$th term of the sequence.
  • Given a positive integer \$n\$, output the first \$n\$ terms of the sequence.
  • Take no input and output the entire sequence by
    • printing infinitely or
    • returning a lazy list or a generator.

Standard rules apply. The shortest code in bytes wins.

From the infinite triangular array of positive integers, select every 2nd numbers on every 2nd row as shown below:

$$ \underline{1} \\ \;2\; \quad \;3\; \\ \;\underline{4}\; \quad \;5\; \quad \;\underline{6}\; \\ \;7\; \quad \;8\; \quad \;9\; \quad 10 \\ \underline{11} \quad 12 \quad \underline{13} \quad 14 \quad \underline{15} \\ 16 \quad 17 \quad 18 \quad 19 \quad 20 \quad 21 \\ \underline{22} \quad 23 \quad \underline{24} \quad 25 \quad \underline{26} \quad 27 \quad \underline{28} \\ \cdots $$

The resulting sequence (A185868) is as follows:

1, 4, 6, 11, 13, 15, 22, 24, 26, 28, 37, 39, 41, 43, 45, 56, 58, 60, 62, 64, 66,
79, 81, 83, 85, 87, 89, 91, 106, 108, 110, 112, 114, 116, 118, 120, 137, ...

The task is to output this sequence.

I/O rules apply. You can choose to implement one of the following:

  • Given the index \$n\$ (0- or 1-based), output the \$n\$th term of the sequence.
  • Given a positive integer \$n\$, output the first \$n\$ terms of the sequence.
  • Take no input and output the entire sequence by
    • printing infinitely or
    • returning a lazy list or a generator.

Standard rules apply. The shortest code in bytes wins.

Source Link
Bubbler
  • 78.4k
  • 5
  • 149
  • 469

Triangular polkadot numbers

Given the infinite triangular array of positive integers, select every 2nd numbers on every 2nd row.

$$ \underline{1} \\ \;2\; \quad \;3\; \\ \;\underline{4}\; \quad \;5\; \quad \;\underline{6}\; \\ \;7\; \quad \;8\; \quad \;9\; \quad 10 \\ \underline{11} \quad 12 \quad \underline{13} \quad 14 \quad \underline{15} \\ 16 \quad 17 \quad 18 \quad 19 \quad 20 \quad 21 \\ \underline{22} \quad 23 \quad \underline{24} \quad 25 \quad \underline{26} \quad 27 \quad \underline{28} \\ \cdots $$

The resulting sequence (A185868) is as follows:

1, 4, 6, 11, 13, 15, 22, 24, 26, 28, 37, 39, 41, 43, 45, 56, 58, 60, 62, 64, 66,
79, 81, 83, 85, 87, 89, 91, 106, 108, 110, 112, 114, 116, 118, 120, 137, ...

I/O rules apply. You can choose to implement one of the following:

  • Given the index \$n\$ (0- or 1-based), output the \$n\$th term of the sequence.
  • Given a positive integer \$n\$, output the first \$n\$ terms of the sequence.
  • Take no input and output the entire sequence by
    • printing infinitely or
    • returning a lazy list or a generator.

Standard rules apply. The shortest code in bytes wins.