← RoseCode

ROSECODE 226

Meanderings

Philippe_57721 · Programming ·

A ant walks exploring each lattice point in the first quadrant of the plane with the following pattern:

37 → 38 → 39 → 40 → 41 → 42 → 43
↑ ↓
36 ← 35 ← 34 ← 33 ← 32 ← 31 44
↑ ↓
17 → 18 → 19 → 20 → 21 30 45
↑ ↓ ↑ ↓
16 ← 15 ← 14 ← 13 22 29 46
↑ ↓ ↑ ↓
5 → 6 → 7 12 23 28 47
↑ ↓ ↑ ↓ ↑ ↓
4 ← 3 8 11 24 27 48
↑ ↓ ↑ ↓ ↑ ↓
1 → 2 9 → 10 25 → 26 49

The 1st point visited (index = 1) is (0,0)
The 10th point is (3,0)
The 100000th point is (143,316)

What is the 10^17-th point?
What is the index of the point (718281828,141592653)?

Answer format: x,y/index

Example: 143,316/51594074 // For 10^5 and (7182,1415)
[My timing: < 100 ms]