> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/perl6-rosettacode/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trizen.gitbook.io/perl6-rosettacode/programming_tasks/n/numbers_whose_binary_and_ternary_digit_sums_are_prime.md).

# Numbers whose binary and ternary digit sums are prime

```perl
say (^200).grep(-> $n {all (2,3).map({$n.base($_).comb.sum.is-prime}) }).batch(10)».fmt('%3d').join: "\n";
```

#### Output:

```
  5   6   7  10  11  12  13  17  18  19
 21  25  28  31  33  35  36  37  41  47
 49  55  59  61  65  67  69  73  79  82
 84  87  91  93  97 103 107 109 115 117
121 127 129 131 133 137 143 145 151 155
157 162 167 171 173 179 181 185 191 193
199
```
