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.

A330355 Starting from n: as long as the decimal representation contains a positive multiple of 3, divide the largest and leftmost such substring by 3; a(n) corresponds to the final value.

This page as a plain text file.
%I A330355 #18 Dec 26 2019 05:44:55
%S A330355 0,1,2,1,4,5,2,7,8,1,10,11,4,11,14,5,4,17,2,11,20,7,22,7,8,25,22,1,28,
%T A330355 7,10,11,4,11,14,5,4,17,2,11,40,41,14,41,44,5,14,47,4,41,50,17,52,17,
%U A330355 2,55,52,11,58,17,20,7,22,7,8,25,22,1,28,7,70,71,8
%N A330355 Starting from n: as long as the decimal representation contains a positive multiple of 3, divide the largest and leftmost such substring by 3; a(n) corresponds to the final value.
%C A330355 This sequence is a variant of A329424.
%H A330355 Robert Israel, <a href="/A330355/b330355.txt">Table of n, a(n) for n = 0..10000</a>
%H A330355 Rémy Sigrist, <a href="/A330355/a330355_1.gp.txt">PARI program for A330355</a>
%F A330355 a(n) <= n with equality iff n = 0 or n belongs to A325112.
%F A330355 a(3^k) = 1 for any k >= 0.
%e A330355 For n = 193:
%e A330355 - 193 gives 1 followed by 93/3 = 131,
%e A330355 - 131 gives 1 followed by 3/3 followed by 1 = 111,
%e A330355 - 111 gives 111/3 = 37,
%e A330355 - 37 gives 3/3 followed by 7 = 17,
%e A330355 - neither 1, 7 nor 17 are divisible by 3, so a(193) = 17.
%p A330355 f:= proc(n) option remember; local L,m,i,d,np1,j,s;
%p A330355   L:= convert(n,base,10);
%p A330355   m:= nops(L);
%p A330355   for d from m to 1 by -1 do
%p A330355     for i from 1 to m-d+1 do
%p A330355       s:= convert(L[i..i+d-1],`+`);
%p A330355       if s > 0 and s mod 3 = 0 then
%p A330355         np1:= add(L[j]*10^(j-1),j=1..i-1)+1/3*add(L[j]*10^(j-1),j=i..i+d-1);
%p A330355         return procname(np1 + 10^(2+ilog10(np1)-(i+d))*add(L[j]*10^(j-1),j=i+d..m));
%p A330355       fi
%p A330355     od
%p A330355   od;
%p A330355   n
%p A330355 end proc:
%p A330355 map(f, [$0..100]); # _Robert Israel_, Dec 25 2019
%o A330355 (PARI) See Links section.
%Y A330355 Cf. A325112, A327539, A329424.
%K A330355 nonn,base,look
%O A330355 0,3
%A A330355 _Rémy Sigrist_, Dec 11 2019