login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A252022 Lexicographically earliest permutation of the positive integers, such that no carry occurs when adjacent terms are added in decimal representation. 8

%I #14 Jul 22 2020 11:42:35

%S 1,2,3,4,5,10,6,11,7,12,13,14,15,20,8,21,16,22,17,30,9,40,18,31,23,24,

%T 25,32,26,33,34,35,41,27,42,36,43,44,45,50,19,60,28,51,37,52,46,53,

%U 100,29,70,101,38,61,102,47,110,39,120,48,111,54,103,55,104

%N Lexicographically earliest permutation of the positive integers, such that no carry occurs when adjacent terms are added in decimal representation.

%C a(n+1) = smallest number, not occurring earlier, such that no carry occurs when adding it to a(n) in decimal arithmetic.

%H Reinhard Zumkeller, <a href="/A252022/b252022.txt">Table of n, a(n) for n = 1..10000</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Carry.html">Carry</a>

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Carry_(arithmetic)">Carry (arithmetic)</a>

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%o (Haskell)

%o import Data.List (delete)

%o a252022 n = a252022_list !! (n-1)

%o a252022_list = 1 : f [1] (drop 2 a031298_tabf) where

%o f xs zss = g zss where

%o g (ds:dss) = if all (<= 9) $ zipWith (+) xs ds

%o then (foldr (\d v -> 10 * v + d) 0 ds) : f ds (delete ds zss)

%o else g dss

%o (Python)

%o A252022_list, l, s, b = [1], [1], 2, set()

%o for _ in range(10**3):

%o ....i = s

%o ....while True:

%o ........if i not in b:

%o ............li = [int(d) for d in str(i)[::-1]]

%o ............for x,y in zip(li,l):

%o ................if x+y > 9:

%o ....................break

%o ............else:

%o ................l = li

%o ................b.add(i)

%o ................A252022_list.append(i)

%o ................while s in b:

%o ....................b.remove(s)

%o ....................s += 1

%o ................break

%o ........i += 1 # _Chai Wah Wu_, Dec 14 2014

%Y Cf. A252001 (carries required); A252023 (inverse), A252079 (fixed points), A251984, A167831.

%Y Cf. A262604 (first differences).

%K nonn,base

%O 1,2

%A _Reinhard Zumkeller_, Dec 12 2014

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 15:20 EDT 2024. Contains 371916 sequences. (Running on oeis4.)