Exercise Idea: Kafka Printer

Open
#1,570 14 comments 8 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@sshine is already working on this.

Since Aug 15, 2019.

Assessment

This issue has not been assessed yet.

Description

new exercise idea

This exercise idea is based on a story from my current work place: My boss'es Ubuntu had a bug that made his printer, when asked to print N copies of something, instead print N² copies. So for our Thursday status meeting, he'd hope that the number of people who show up, for whom he would bring a copy of his status report, was targetable with as few print requests as possible.

For example, if 13 people would show up to the meeting, he would first ask the printer of 3 copies (yielding 9 copies), and then 2 copies (yielding 4 copies), with a final result of 3² + 2² = 13 copies. For some numbers of employees, this was simply not possible with two print jobs, and he'd need to consult the printer a third time.

The exercise is to write a function that computes the groan factor, being the minimal number of print jobs it takes to print N copies of a status report when the printer gives you back N² copies.

Examples:

  • It takes 1 print job to print 1 copy because 1² = 1.
  • It takes 2 print jobs to print 5 copies: 2² + 1² = 5.
  • It takes 3 print jobs to print 11 copies: 3² + 1² + 1² = 11.

The suggested exercise name underlines the kafkaesque hope that a specific number of employees N show up on Thursdays such that ∃ a, b ∈ ℕ₀: a² + b² = N for optimal working conditions.

Dominant language
Ruby
Stars
362
Forks
566
Avg merge
15h 13m
Merged PRs (30d)
8

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from exercism/problem-specifications

All issues in exercism/problem-specifications

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.