Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #21 Dec 10 2023 18:07:27
%S 1,2,3,5,8,12,14,11,7,9,20,16,18,79,25,27,88,34,36,97,43,45,101,29,49,
%T 110,38,54,200,47,58,699,56,67,789,65,76,798,74,85,879,83,94,888,92,
%U 139,897,119,148,969,128,157,978,137,166,987,146,175,996,155,184,1001,69,89,1010,78,98,1100,87,179,2000,96,188,5999,159,197,6899
%N Lexicographically earliest sequence of distinct positive integers such that the sum of the digits of a(n) is either the sum of all the digits of a(n-1) and a(n+1), or is the absolute difference |(sum of digits of a(n-1)) - (sum of digits of a(n+1))|, for n > 1.
%C To get the "New sequence" below, replace all terms by the sum of their digits:
%C This seq = 1,2,3,5,8,12,14,11,7,9,20,16,18,79,25,27,88,...
%C New seq = 1,2,3,5,8, 3, 5, 2,7,9, 2, 7, 9,16, 7, 9,16,...
%C We see that every term of the "New sequence" is either the sum of its two adjacent terms, or their absolute difference.
%C This sequence may not be a permutation of the positive integers as the number 10 does not appear among the first 1000000 terms (according to Rémy Sigrist).
%H Jean-Marc Falcoz, <a href="/A308075/b308075.txt">Table of n, a(n) for n = 1..1502</a>
%H Rémy Sigrist, <a href="/A308075/a308075.png">Logarithmic scatterplot of the first 1000000 terms</a>
%H Rémy Sigrist, <a href="/A308075/a308075_1.png">Scatterplot of the digital sums of the first 1000000 terms</a>
%H Rémy Sigrist, <a href="/A308075/a308075.gp.txt">PARI program for A308075</a>
%e a(2) = 2 is |1-3|;
%e a(3) = 3 is |2-5|;
%e a(4) = 5 is |3-8|;
%e a(5) = 8 is (5+1+2);
%e a(6) = 12 because 12 gives (1+2) = 3 and this 3 is (8-1-4);
%e a(7) = 14 because 14 gives (1+4) = 5 and this 5 is (1+2+1+1);
%e a(8) = 11 because 11 gives (1+1) = 2 and this 2 is |1+4-7|;
%e etc.
%o (PARI) See Links section.
%Y Cf. A007953 (Digital sum (i.e., sum of digits) of n; also called digsum(n)), A307638 (digital sums of this sequence).
%K base,nonn
%O 1,2
%A _Eric Angelini_ and _Jean-Marc Falcoz_, May 11 2019