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.

Showing 1-2 of 2 results.

A327539 Starting from n: as long as the decimal representation starts with a positive even number, divide the largest such prefix by 2; a(n) corresponds to the final value.

Original entry on oeis.org

0, 1, 1, 3, 1, 5, 3, 7, 1, 9, 5, 11, 3, 13, 7, 15, 1, 17, 9, 19, 5, 11, 11, 13, 3, 15, 13, 17, 7, 19, 15, 31, 1, 33, 17, 35, 9, 37, 19, 39, 5, 11, 11, 13, 11, 15, 13, 17, 3, 19, 15, 51, 13, 53, 17, 55, 7, 57, 19, 59, 15, 31, 31, 33, 1, 35, 33, 37, 17, 39, 35, 71
Offset: 0

Views

Author

Rémy Sigrist, Nov 29 2019

Keywords

Comments

For n > 0, as long as we have a number whose decimal representation is the concatenation of a positive even number, say u, and a possibly empty string of odd digits, say v, we replace this number with the concatenation of u/2 and v; eventually only odd digits remain.

Examples

			For n = 10000:
- 10000 gives 10000/2 = 5000,
- 5000 gives 5000/2 = 2500,
- 2500 gives 2500/2 = 1250,
- 1250 gives 125/2 = 625,
- 625 gives 62/2 followed by 5 = 315,
- 315 has only odd digits, so a(10000) = 315.
		

Crossrefs

See A329249, A329424 and A329428 for similar sequences.

Programs

Formula

a(n) <= n with equality iff n = 0 or n belongs to A014261.
a(2*n) = a(n).
a(10*k + v) = 10*a(k) + v for any k >= 0 and v in {1, 3, 5, 7, 9}.
a(n) = 1 iff n is a power of 2.
a(n) = 3 iff n belongs to A007283.
a(n) = 5 iff n belongs to A020714.
a(n) = 7 iff n belongs to A005009.
a(n) = 9 iff n belongs to A005010.
a(n) = a(n+1) iff n belongs to A215145.

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.

Original entry on oeis.org

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, 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, 2, 55, 52, 11, 58, 17, 20, 7, 22, 7, 8, 25, 22, 1, 28, 7, 70, 71, 8
Offset: 0

Views

Author

Rémy Sigrist, Dec 11 2019

Keywords

Comments

This sequence is a variant of A329424.

Examples

			For n = 193:
- 193 gives 1 followed by 93/3 = 131,
- 131 gives 1 followed by 3/3 followed by 1 = 111,
- 111 gives 111/3 = 37,
- 37 gives 3/3 followed by 7 = 17,
- neither 1, 7 nor 17 are divisible by 3, so a(193) = 17.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) option remember; local L,m,i,d,np1,j,s;
      L:= convert(n,base,10);
      m:= nops(L);
      for d from m to 1 by -1 do
        for i from 1 to m-d+1 do
          s:= convert(L[i..i+d-1],`+`);
          if s > 0 and s mod 3 = 0 then
            np1:= add(L[j]*10^(j-1),j=1..i-1)+1/3*add(L[j]*10^(j-1),j=i..i+d-1);
            return procname(np1 + 10^(2+ilog10(np1)-(i+d))*add(L[j]*10^(j-1),j=i+d..m));
          fi
        od
      od;
      n
    end proc:
    map(f, [$0..100]); # Robert Israel, Dec 25 2019
  • PARI
    See Links section.

Formula

a(n) <= n with equality iff n = 0 or n belongs to A325112.
a(3^k) = 1 for any k >= 0.
Showing 1-2 of 2 results.