login
A349119
a(0) = 1; for n>0, a(n) is the smallest positive integer that has not previously occurred such that |n - a(n-1)| + a(n) is a square.
2
1, 4, 2, 3, 8, 6, 9, 7, 15, 10, 16, 11, 24, 5, 27, 13, 22, 20, 14, 31, 25, 12, 26, 33, 40, 21, 44, 19, 55, 23, 18, 36, 32, 35, 48, 51, 34, 46, 17, 42, 47, 30, 37, 43, 63, 82, 28, 45, 61, 52, 62, 38, 50, 78, 57, 79, 41, 65, 29, 70, 39, 59, 97, 66, 98, 67, 80, 68, 49, 101, 69, 119, 53, 124, 71, 60
OFFSET
0,2
EXAMPLE
a(1) = 4 as |1 - a(0)| = |1 - 1| = 0, and 0 + 4 = 4 = 2^2 is the next smallest square. Note a(1) cannot be 1 as a(0) = 1.
a(4) = 8 as |4 - a(3)| = |4 - 3| = 1, and 1 + 8 = 9 = 3^2 is the next smallest square. Note a(4) cannot be 3 as a(3) = 3.
a(8) = 15 as |8 - a(7)| = |8 - 7| = 1, and 1 + 15 = 16 = 4^2 is the next smallest square. Note a(8) cannot be 3 or 8 as these have previously occurred.
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Scott R. Shannon, Nov 08 2021
STATUS
approved