A329545 After a(1) = 1, add the even terms and subtract the odd ones, the result must always be a palindrome. This is the lexicographically earliest sequence of distinct positive integers with this property.
1, 2, 3, 4, 18, 11, 5, 16, 13, 7, 6, 14, 15, 26, 22, 33, 17, 28, 25, 36, 35, 9, 8, 58, 55, 44, 46, 10, 20, 30, 73, 77, 66, 24, 40, 50, 103, 79, 68, 34, 23, 81, 48, 47, 80, 83, 72, 54, 43, 85, 52, 49, 38, 37, 70, 64, 53, 87, 32, 27, 60, 57, 90, 12, 45, 59, 92, 42, 75, 61, 94, 62, 95, 63, 74, 69, 194
Offset: 1
Examples
The sequence starts with 1, smallest positive integer. 1 + 2 = 3 (palindrome) 1 + 2 - 3 = 0 (palindrome) 1 + 2 - 3 + 4 = 1 (palindrome) 1 + 2 - 3 + 4 + 18 = 22 (palindrome) 1 + 2 - 3 + 4 + 18 - 11 = 11 (palindrome) 1 + 2 - 3 + 4 + 18 - 11 - 5 = 6 (palindrome) 1 + 2 - 3 + 4 + 18 - 11 - 5 + 16 = 22 (palindrome), etc.
Links
- Jean-Marc Falcoz, Table of n, a(n) for n = 1..49999
Crossrefs
Programs
-
PARI
A329545_vec(N, u=1, U, a, s=2, d)={vector(N, n, a=u; while(bittest(U, a-u)|| Vecrev(d=digits(s+(-1)^a*a))!=d|| (a>s&&bittest(a, 0)), a++); s+=(-1)^a*a; U+=1<<(a-u); while(bittest(U, 0), U>>=1; u++); a)} \\ M. F. Hasler, Nov 16 2019
Comments