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-5 of 5 results.

A329424 Starting from n: as long as the decimal representation starts with a positive multiple of 3, divide the largest such prefix 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, 13, 14, 5, 16, 17, 2, 19, 20, 7, 22, 23, 8, 25, 26, 1, 28, 29, 10, 11, 4, 11, 14, 5, 4, 17, 2, 13, 40, 41, 14, 43, 44, 5, 46, 47, 16, 49, 50, 17, 52, 53, 2, 55, 56, 19, 58, 59, 20, 7, 22, 7, 8, 25, 22, 1, 28, 23, 70, 71
Offset: 0

Views

Author

Rémy Sigrist, Nov 30 2019

Keywords

Comments

As long as we have a number whose decimal representation is the concatenation of a positive multiple of 3, say u, and a minimal string possibly empty, say v, we replace this number with the concatenation of u/3 and v; eventually none of the prefixes will be a positive multiple of 3.

Examples

			For n = 1011:
- 1011 gives 1011/3 = 337,
- 337 gives 33/3 followed by 7 = 117,
- 117 gives 117/3 = 39,
- 39 gives 39/3 = 13,
- neither 1 nor 13 is a multiple of 3, so a(1011) = 13.
		

Crossrefs

See A327539 for similar sequences.

Programs

  • PARI
    t(n) = if (n==0, 0, n%3==0, n/3, 10*t(n\10)+(n%10))
    a(n) = while (n!=n=t(n),); n

Formula

a(n) <= n.

A329428 Starting from n: as long as the decimal representation starts with a prime number, replace the largest such prefix with the index of the corresponding prime number; a(n) corresponds to the final value.

Original entry on oeis.org

0, 1, 1, 1, 4, 1, 6, 4, 8, 9, 10, 1, 12, 6, 14, 15, 16, 4, 18, 8, 10, 1, 12, 9, 14, 15, 16, 4, 18, 10, 10, 1, 12, 9, 14, 15, 16, 12, 18, 10, 40, 6, 42, 14, 44, 45, 46, 15, 48, 49, 10, 1, 12, 16, 14, 15, 16, 12, 18, 4, 60, 18, 62, 63, 64, 65, 66, 8, 68, 69, 40
Offset: 0

Views

Author

Rémy Sigrist, Nov 30 2019

Keywords

Comments

As long as we have a number whose decimal representation is the concatenation of a prime number, say the k-th prime number, and a minimal string possibly empty or with leading zeros, say v, we replace this number with the concatenation of k and v; eventually none of the prefixes will be a prime number.

Examples

			For n = 991:
- let pi denote A000720,
- 991 gives pi(991) = 167,
- 167 gives pi(167) = 39,
- 39 gives pi(3) followed by 9 = 29,
- 29 gives pi(29) = 10,
- neither 1 nor 10 is a prime number, so a(991) = 10.
		

Crossrefs

See A327539 for similar sequences.

Programs

  • Mathematica
    Array[Which[# == 0, 0, # == 1, 1, True, FixedPoint[If[! IntegerQ@ #1, FromDigits[#2], FromDigits[Join @@ {IntegerDigits@ PrimePi@ #1, Drop[#2, IntegerLength@ #1]}]] & @@ {SelectFirst[Table[FromDigits[#[[1 ;; i]]], {i, Length@ #, 1, -1}], PrimeQ], #} &@ IntegerDigits[#] &, #]] &, 71, 0] (* Michael De Vlieger, Dec 01 2019 *)
    f[n_]:=Block[{p,r,d = IntegerDigits@ n,v=n}, Do[{p,r}= FromDigits/@ TakeDrop[d,k]; If[PrimeQ@ p, v=PrimePi[p] 10^(Length[d]-k)+r; Break[]],{k, Length@d, 1, -1}]; v]; a[n_]:= FixedPoint[f, n]; Array[a,71,0] (* Giovanni Resta, Dec 02 2019 *)
  • PARI
    t(n) = if (n==0, 0, isprime(n), primepi(n), 10*t(n\10)+(n%10))
    a(n) = while (n!=n=t(n),); n

Formula

a(n) <= n with equality iff n belongs to A202259.
a(prime(k)) = a(k) for any k > 0 where prime(k) denotes the k-th prime number.
a(10*k + v) = 10*a(k) + v for any k > 0 and v in {0, 2, 4, 5, 6, 8}.
a(A007097(k)) = 1 for any k >= 0.

A329249 Starting from n: as long as the decimal representation starts with an odd number, multiply the largest such prefix by 2; a(n) corresponds to the final value.

Original entry on oeis.org

0, 2, 2, 6, 4, 20, 6, 24, 8, 28, 20, 22, 22, 26, 24, 60, 26, 64, 28, 68, 20, 42, 22, 46, 24, 200, 26, 204, 28, 208, 60, 62, 62, 66, 64, 240, 66, 244, 68, 248, 40, 82, 42, 86, 44, 280, 46, 284, 48, 288, 200, 202, 202, 206, 204, 220, 206, 224, 208, 228, 60, 222
Offset: 0

Views

Author

Rémy Sigrist, Nov 30 2019

Keywords

Comments

As long as we have a number whose decimal representation is the concatenation of odd number, say u, and a possibly empty string of even digits allowing leading zeros, say v, we replace this number with the concatenation of u*2 and v; eventually only even digits remain.

Examples

			For n = 127:
- 127 gives 127*2 = 254,
- 254 gives 25*2 followed by 4 = 504,
- 504 gives 5*2 followed by 04 = 1004,
- 1004 gives 1*2 followed by 004 = 2004,
- 2004 has only even digits, so a(127) = 2004.
		

Crossrefs

See A327539 for similar sequences.
Cf. A014263.

Programs

Formula

a(n) >= n with equality iff n belongs to A014263.
a(2*n+1) = a(4*n+2).
a(10*k + v) = 10*a(k) + v for any k >= 0 and v in {0, 2, 4, 6, 8}.
a(5^k) = 2*10^k for any k >= 0 (the ratio a(n)/n is unbounded).

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.

A330356 Starting from n: as long as the decimal representation contains a prime number, replace the largest and leftmost such substring with the index of the corresponding prime number; a(n) corresponds to the final value.

Original entry on oeis.org

0, 1, 1, 1, 4, 1, 6, 4, 8, 9, 10, 1, 1, 6, 14, 6, 16, 4, 18, 8, 10, 1, 1, 9, 14, 9, 16, 14, 18, 10, 10, 1, 1, 9, 14, 9, 16, 1, 18, 10, 40, 6, 6, 14, 44, 14, 46, 6, 48, 49, 10, 1, 1, 16, 14, 9, 16, 14, 18, 4, 60, 18, 18, 18, 64, 18, 66, 8, 68, 69, 40, 10, 6, 1
Offset: 0

Views

Author

Rémy Sigrist, Dec 11 2019

Keywords

Comments

This sequence is a variant of A329428.

Examples

			For n = 8601:
- let pi = A000720,
- 8601 gives 8 followed by pi(601) = 8110,
- 8110 gives pi(811) followed by 0 = 1410,
- 1410 gives 1 followed by pi(41) followed by 0 = 1130,
- 1130 gives pi(113) followed by 0 = 300,
- 300 gives pi(3) followed by 00 = 200,
- 200 gives pi(2) followed by 00 = 100,
- no prime number appears in 100,
- hence a(8601) = 100.
		

Crossrefs

Programs

  • PARI
    See Links section.

Formula

a(n) <= n with equality iff n belongs to A062115.
a(prime(k)) = a(k) for any k > 0 where prime(k) denotes the k-th prime number.
a(A007097(k)) = 1 for any k >= 0.
Showing 1-5 of 5 results.