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.

A299402 Lexicographic first sequence of positive integers such that a(n)*a(n+1) has a digit 2, and no term occurs twice.

This page as a plain text file.
%I A299402 #12 Feb 12 2023 12:30:11
%S A299402 1,2,6,4,3,7,16,8,9,14,13,17,12,10,20,11,19,15,18,24,5,25,21,22,26,27,
%T A299402 23,34,28,29,32,31,33,37,35,36,42,30,40,38,39,48,43,44,46,45,47,41,49,
%U A299402 50,51,52,53,54,55,59,58,56,57,60,62,61,66,64,63,67,69,68,65,80,74,71,72,73,77,76,70,75,79,78,84,83,81,82,86,87,95,96,92
%N A299402 Lexicographic first sequence of positive integers such that a(n)*a(n+1) has a digit 2, and no term occurs twice.
%C A299402 A permutation of the positive integers.
%H A299402 Robert Israel, <a href="/A299402/b299402.txt">Table of n, a(n) for n = 1..10000</a>
%e A299402 a(1) = 1 is the least positive integer, it has no other requirement to satisfy.
%e A299402 a(2) = 2 is the least positive integer > a(1) = 1, and a(2)*a(1) = 2 has a digit 2.
%e A299402 a(3) = 6 is the least positive integer > a(2) = 2 such that a(3)*a(2) (= 12) has a digit 2: The smaller choices 3, 4 or 5 do not satisfy this.
%e A299402 a(4) = 4 is the least positive integer > a(2) = 2 such that a(4)*a(3) (= 24) has a digit 2: The smaller choice 3 yields 3*6 = 18 and does not satisfy this.
%e A299402 Now, the least available positive integer a(5) = 3 is such that 3*4 = 12, which has again a digit 2. And so on.
%p A299402 N:= 100: # to get a(1)..a(n) where a(n+1) > N
%p A299402 S:= [$2..N]: nS:= N-1:
%p A299402 R:= 1: x:= 1; found:= true;
%p A299402 while found do
%p A299402   found:= false;
%p A299402   for i from 1 to nS do
%p A299402     if member(2, convert(S[i]*x,base,10)) then
%p A299402        found:= true;
%p A299402        x:= S[i];
%p A299402        R:= R,x;
%p A299402        S:= subsop(i=NULL,S);
%p A299402        nS:= nS-1;
%p A299402        break
%p A299402     fi
%p A299402   od
%p A299402 od:
%p A299402 R; # _Robert Israel_, Feb 12 2023
%o A299402 (PARI) a(n,f=1,d=2,a=1,u=[a])={for(n=2,n,f&&if(f==1,print1(a","),write(f,n-1," "a));for(k=u[1]+1,oo,setsearch(u,k)&&next;setsearch(Set(digits(a*k)),d)&&(a=k)&&break);u=setunion(u,[a]);while(#u>1&&u[2]==u[1]+1,u=u[^1]));a}
%Y A299402 Cf. A299403, A298974, ..., A298979 (analog with digit 3, ..., 9).
%Y A299402 Cf. A299957, A299969, ..., A299988 (analog with addition instead of multiplication, and different digits).
%K A299402 nonn,base
%O A299402 1,2
%A A299402 _M. F. Hasler_, Feb 22 2018