Problem 46
Perl6
1my @primes = (1..*).grep(*.is-prime);
2my $iterator;
3my $is-square-num;
4my $found;
5sub is-answer($num) {
6 $iterator = 0;
7 $found = True;
8 while @primes[$iterator] < $num {
9 $is-square-num = sqrt(($num - @primes[$iterator])/2);
10 if $is-square-num % 1 == 0 { return False }
11 $iterator += 1;
12 }
13 if $found { return True }
14}
15
16say (33..*).first({
17 $_ % 2 == 1 and !($_.is-prime) and is-answer($_)
18})