cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A330674 Lexicographically earliest infinite sequence of distinct nonnegative terms such that a(n+1) is obtained by adding to a(n) the odd digits of a(n) and subtracting the even ones.

This page as a plain text file.
%I A330674 #11 Jan 06 2020 09:17:56
%S A330674 1,2,0,3,6,4,5,10,11,13,17,25,28,18,7,14,8,9,12,15,21,20,16,19,29,36,
%T A330674 33,39,51,57,69,72,77,91,101,103,107,115,122,119,130,134,22,23,24,26,
%U A330674 27,32,30,31,35,43,42,34,37,47,50,55,65,64,54,38,40,41,44,45,46,48,49,52,53,61,56,58,59,73,83,78
%N A330674 Lexicographically earliest infinite sequence of distinct nonnegative terms such that a(n+1) is obtained by adding to a(n) the odd digits of a(n) and subtracting the even ones.
%C A330674 When an iteration reproduces a term already in the sequence, we cancel this iteration and restart the sequence from there with the smallest integer not yet present in the sequence.
%e A330674 As a(1) = 1, we get a(2) = 2 by adding the odd digit 1 to a(1);
%e A330674 as a(2) = 2, we  get a(3) = 0 by subtracting the even digit 2 from a(2);
%e A330674 as a(3) = 0, we stop to iterate (0 would produce 0, already in the sequence) and restart the sequence with a(4) = 3, the smallest integer not present;
%e A330674 as a(4) = 3, we get a(5) = 6 by adding the odd digit 3 to a(4);
%e A330674 as a(5) = 6, we stop to iterate (6-6 produces 0, already in the sequence) and restart the sequence with a(6) = 4, the smallest integer not present;
%e A330674 as a(6) = 4, we stop to iterate (4-4 produces 0, already in the sequence) and restart the sequence with a(7) = 5, the smallest integer not present;
%e A330674 as a(7) = 5, we get a(8) = 10 by adding the odd digit 5 to a(7);
%e A330674 as a(8) = 10, we get a(9) = 11 by adding the odd digit 1 to a(8);
%e A330674 as a(9) = 11, we get a(10) = 13 by adding the odd digits 1 and 1 to a(9); etc.
%t A330674 Nest[Append[#1, If[FreeQ[#1, #2], #2, Block[{k = 3}, While[! FreeQ[#1, k], k++]; k]] & @@ {#1, #1[[-1]] + Total@ Select[#2, OddQ] - Total@ Select[#2, EvenQ]} & @@ {#, IntegerDigits@ #[[-1]]}] &, {1}, 77] (* _Michael De Vlieger_, Dec 24 2019 *)
%Y A330674 Cf. A036301 (Numbers n such that sum of even digits of n equals sum of odd digits of n).
%K A330674 base,nonn
%O A330674 1,2
%A A330674 _Eric Angelini_ and _Carole Dubois_, Dec 24 2019