# How to sum tuple elements

**URL:** <https://discourse.julialang.org/t/how-to-sum-tuple-elements/65753>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [August 3, 2021, 3:52pm UTC](https://discourse.julialang.org/t/how-to-sum-tuple-elements/65753 "2021-08-03T15:52:57Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [August 3, 2021, 4:39pm UTC](https://discourse.julialang.org/t/how-to-sum-tuple-elements/65753/6 "2021-08-03T16:39:06Z")

</div>

It doesn’t here, just copying and pasting your code:

```julia
julia
               _
   _ _ _(_)_ | Documentation: https://docs.julialang.org
  (_) | (_) (_) |
   _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 1.6.2 (2021-07-14)
 _/ |\ __'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |

julia> numbers = [1,2,3,4,5]
5-element Vector{Int64}:
 1
 2
 3
 4
 5

julia> x = collect(Iterators.product(numbers, numbers))
5×5 Matrix{Tuple{Int64, Int64}}:
 (1, 1) (1, 2) (1, 3) (1, 4) (1, 5)
 (2, 1) (2, 2) (2, 3) (2, 4) (2, 5)
 (3, 1) (3, 2) (3, 3) (3, 4) (3, 5)
 (4, 1) (4, 2) (4, 3) (4, 4) (4, 5)
 (5, 1) (5, 2) (5, 3) (5, 4) (5, 5)

julia> y = filter(t -> sum(t) == 6, x)
5-element Vector{Tuple{Int64, Int64}}:
 (5, 1)
 (4, 2)
 (3, 3)
 (2, 4)
 (1, 5)

julia> 

```

---

_[View the full topic](https://discourse.julialang.org/t/how-to-sum-tuple-elements/65753)._
