Skip to main content
2 of 9
deleted 3 characters in body
Kapocsi
  • 221
  • 1
  • 4

Python 3, 104 bytes

from math import floor,sqrt
def a(n):x=(floor(sqrt(n-1))+1)//2;return 8*x**2+(6,-2)[n<=4*x**2+2*x]*x+2-n
Kapocsi
  • 221
  • 1
  • 4