File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 82
82
| 87 | Prime power triples | :small_blue_diamond : [ Python] ( ../projecteuler/python/p087.py )
83
83
| 92 | Square digit chains | :small_orange_diamond : [ Python] ( ../projecteuler/python/p092.py )
84
84
| 97 | Large non-Mersenne prime | :small_blue_diamond : [ Python] ( ../projecteuler/python/p097.py )
85
+ | 145 | How many reversible numbers are there below one-billion? | :small_orange_diamond : [ Lua] ( ../projecteuler/python/p145.py )
85
86
| 205 | Dice game | :small_blue_diamond : [ Python] ( ../projecteuler/python/p205.py )
86
87
| 206 | Concealed square | :small_orange_diamond : [ Python] ( ../projecteuler/python/p206.py )
87
88
| 243 | Resilience | :small_orange_diamond : [ Python] ( ../projecteuler/python/p243.py ) :small_orange_diamond : [ Lua] ( ../projecteuler/lua/p243.lua )
Original file line number Diff line number Diff line change
1
+ function reverseSum (n )
2
+ return n + string.reverse (n )
3
+ end
4
+
5
+ function isAllOdd (n )
6
+ for digit in string.gmatch (math.floor (n ), ' %d' ) do
7
+ if digit % 2 == 0 then
8
+ return false
9
+ end
10
+ end
11
+ return true
12
+ end
13
+
14
+ count = 0
15
+ for i = 1 , 10 ^ 9 do
16
+ if i % 10 ~= 0 and isAllOdd (reverseSum (i )) then
17
+ count = count + 1
18
+ end
19
+ end
20
+ print (count )
You can’t perform that action at this time.
0 commit comments