OFFSET
1,3
COMMENTS
FORMULA
From Robert Israel, Sep 22 2024 (Start):
Let a(n) mod 10 = d.
If 1 <= d <= 8 then a(3 n + 6 + j) = 10 a(n) + d + j for j = -1, 0, 1.
If d = 0 and n > 1, then a(3 n + 5) = 10 a(n), a(3 n + 6) = 10 a(n) + 1, a(3 n + 7) = 10 a(n) + 9.
If d = 9, then a(3 n + 5) = 10 a(n), a(3 n + 6) = 10 a(n) + 8, a(3 n + 7) = 10 a(n) + 9.
(End)
EXAMPLE
11 is a term because 1 = 1.
32 is a terms because 3 is a neighbor of 2.
109 is a term because 1 is a neighbor of 0 and 0 is a neighbor of 9 (modulo 10).
121 is a term because 1 is a neighbor of 2 and 2 is a neighbor of 1.
MAPLE
f:= proc(n) local i;
seq(10*n+i, i= sort([n-1, n, n+1] mod 10))
end proc:
S:= [$1..9]: R:= 0, op(S):
for i from 1 to 3 do
S:= map(f, S); R:= R, op(S)
od:
R; # Robert Israel, Sep 22 2024
PROG
(PARI) isok(k)={my(v=digits(k)); for(i=2, #v, my(t=abs(v[i]-v[i-1])); if(t>1&&t<9, return(0))); 1}
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Andrew Howroyd, Sep 22 2024
STATUS
approved