OFFSET
1,3
COMMENTS
This definition comes from Patrick De Geest's link.
When the absolute differences between two adjacent digits are always equal (e.g., 85858), these numbers are called smoothly undulating numbers and form a subsequence (A046075).
The definition includes the trivial 1- and 2-digit undulating numbers.
The sequence differs from A160542 (which contains 100). - R. J. Mathar, Aug 05 2022
LINKS
Patrick De Geest, Smoothly Undulating Palindromic Primes, World of Numbers.
EXAMPLE
MAPLE
isA355301 := proc(n)
local dgs, i, back, forw ;
dgs := convert(n, base, 10) ;
if nops(dgs) < 2 then
return true;
end if;
for i from 2 to nops(dgs)-1 do
back := op(i, dgs) -op(i-1, dgs) ;
forw := op(i+1, dgs) -op(i, dgs) ;
if back*forw >= 0 then
return false;
end if ;
end do:
back := op(-1, dgs) -op(-2, dgs) ;
if back = 0 then
return false;
end if ;
return true ;
end proc:
A355301 := proc(n)
option remember ;
if n = 1 then
0;
else
for a from procname(n-1)+1 do
if isA355301(a) then
return a;
end if;
end do:
end if;
end proc:
seq(A355301(n), n=1..110) ; # R. J. Mathar, Aug 05 2022
MATHEMATICA
q[n_] := AllTrue[(s = Sign[Differences[IntegerDigits[n]]]), # != 0 &] && AllTrue[Differences[s], # != 0 &]; Select[Range[0, 100], q] (* Amiram Eldar, Jun 28 2022 *)
PROG
(PARI) isok(m) = if (m<10, return(1)); my(d=digits(m), dd = vector(#d-1, k, sign(d[k+1]-d[k]))); if (#select(x->(x==0), dd), return(0)); my(pdd = vector(#dd-1, k, dd[k+1]*dd[k])); #select(x->(x>0), pdd) == 0; \\ Michel Marcus, Jun 30 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Bernard Schott, Jun 27 2022
STATUS
approved