login
Lucky numbers with consecutive digits.
0

%I #16 Mar 06 2024 04:49:02

%S 21,43,67,87,321,4321,4567,6789,78901,432109,9012345,67890123,

%T 109876543,123456789,6543210987,8901234567

%N Lucky numbers with consecutive digits.

%C Digits can be in ascending or descending order. After 9 comes 0.

%C No more terms below 10^9. - _Amiram Eldar_, Nov 16 2019

%C No more terms below 10^10. - _Kevin P. Thompson_, Mar 04 2022

%t consecutiveQ[n_Integer] := Block[{id = IntegerDigits@n}, MemberQ[{{1}, {9}}, Union@Mod[Rest@id - Most@id, 10]]] (* Bobby R. Treat (drbob(at)bigfoot.com), May 10 2006 *)

%t lst = Range[1, 10^8, 2]; i = 2; While[ i <= (len = Length@lst) && (k = lst[[i]]) <= len, lst = Drop[lst, {k, len, k}]; i++ ]; Select[t, consecutiveQ@# &] (* _Robert G. Wilson v_, May 11 2006 *)

%Y Cf. A000959.

%K base,more,nonn

%O 1,1

%A Luc Stevens (lms022(AT)yahoo.com), May 07 2006

%E a(9)-a(12) from _Robert G. Wilson v_, May 11 2006

%E a(13)-a(14) from _Amiram Eldar_, Nov 16 2019

%E a(15)-a(16) from _Kevin P. Thompson_, Mar 04 2022