login
A355301
Normal undulating numbers where "undulating" means that the alternate digits go up and down (or down and up) and "normal" means that the absolute differences between two adjacent digits may differ.
4
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 101, 102, 103, 104, 105, 106, 107, 108, 109, 120, 121, 130, 131, 132, 140, 141, 142, 143, 150
OFFSET
1,3
COMMENTS
This definition comes from Patrick De Geest's link.
Other definitions for undulating are present in the OEIS (e.g., A033619, A046075).
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.
Subsequence of A043096 where the first different term is A043096(103) = 123 while a(103) = 130.
This sequence first differs from A010784 at a(92) = 101, A010784(92) = 102.
The sequence differs from A160542 (which contains 100). - R. J. Mathar, Aug 05 2022
LINKS
EXAMPLE
111 is not a term here, but A033619(102) = 111.
a(93) = 102, but 102 is not a term of A046075.
Some terms: 5276, 918230, 1053837, 263915847, 3636363636363636.
Are not terms: 1331, 594571652, 824327182.
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
Cf. A059168 (subsequence of primes).
Differs from A010784, A241157, A241158.
Sequence in context: A241158 A241157 A043096 * A010784 A052081 A031995
KEYWORD
nonn,base
AUTHOR
Bernard Schott, Jun 27 2022
STATUS
approved