OFFSET
1,1
COMMENTS
Complement of A128201.
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
FORMULA
Set R(n) = round(sqrt(2*n)), then a(n) = 2*n + R(n) - (R(n) mod 2).
EXAMPLE
a(2) = 6 as the next even after 2, i.e., 4 (a perfect square), drops out and is replaced by following even.
MATHEMATICA
Select[Range[2, 130, 2], ! IntegerQ@ Sqrt[#] &] (* Michael De Vlieger, Oct 01 2021 *)
PROG
(PARI) isok(n) = ((n % 2) == 0) && ! issquare(n); \\ Michel Marcus, Aug 26 2013
(Python)
from math import isqrt
def A157502(n): return (k:=n<<1)+(r:=(m:=isqrt(k))+int((k-m*(m+1)<<2)>=1))-(r&1) # Chai Wah Wu, Jul 30 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Gerald Hillier, Mar 01 2009
EXTENSIONS
More terms from Michel Marcus, Aug 26 2013
STATUS
approved