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.

Previous Showing 11-16 of 16 results.

A338827 For any number with decimal representation (d(1), d(2), ..., d(k)), the decimal representation of a(n) is (abs(d(1)-d(k)), abs(d(2)-d(k-1)), ..., abs(d(k)-d(1))).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 11, 22, 33, 44, 55, 66, 77, 88, 22, 11, 0, 11, 22, 33, 44, 55, 66, 77, 33, 22, 11, 0, 11, 22, 33, 44, 55, 66, 44, 33, 22, 11, 0, 11, 22, 33, 44, 55, 55, 44, 33, 22, 11, 0, 11, 22, 33, 44, 66, 55, 44, 33, 22, 11, 0, 11, 22
Offset: 0

Views

Author

Rémy Sigrist, Nov 11 2020

Keywords

Comments

Leading zeros are ignored.
All terms belong to A061917.

Examples

			For n = 1021:
- abs(1-1) = 0,
- abs(0-2) = 2,
- abs(2-0) = 2,
- abs(1-1) = 0,
- so a(1021) = 220.
		

Crossrefs

Cf. A002113, A004086, A056965, A061917, A175919 (binary analog), A330240, A338828 (ternary analog).

Programs

  • Maple
    a:= n-> (l-> (h-> add(h[j]*10^(j-1), j=1..nops(h)))([seq(
        abs(l[i]-l[-i]), i=1..nops(l))]))(convert(n, base, 10)):
    seq(a(n), n=0..70);  # Alois P. Heinz, Nov 12 2020
  • PARI
    a(n, base=10) = my (d=digits(n, base)); fromdigits(abs(d-Vecrev(d)), base)

Formula

a(n) = 0 iff n is a palindrome (A002113).
a(n) = A330240(n, A004086(n)).

A069024 Numbers that are palindromic in base 2 as well as in base 10 (initial zeros may be prepended).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 33, 40, 60, 66, 80, 90, 99, 252, 272, 292, 313, 330, 585, 626, 660, 717, 990, 2112, 2720, 2772, 2920, 4224, 5850, 6336, 7447, 7470, 8448, 8580, 9009, 15351, 21120, 22122, 25752, 32223, 39993, 40904, 42240, 44244, 48384
Offset: 1

Views

Author

Amarnath Murthy, Apr 02 2002

Keywords

Examples

			66 in base 2 is 1000010, which is palindromic if rewritten as 01000010.
		

Crossrefs

Cf. A007632.
Intersection of A061917 and A057890.

Programs

  • Maple
    nextpal:= proc(p,d,V,b)
      local i,i2,pp,m,m2;
      pp:=p;
      V[1]:= V[1]+1;
      m2:= floor(d/2);
      i2:= ceil(d/2);
      if d::odd then pp:= pp + b^m2 else pp:= pp + b^m2 + b^(m2-1) fi;
      for i from 1 while V[i] = b do
        V[i]:= 0:
        if i = i2 then
          if d::even then
            ArrayTools:-Extend(V,[1],inplace);
            return b^d+1, d+1, V
          else
            V[i2]:= 1;
            return b^d+1, d+1, V;
          fi;
        fi;
        V[i+1]:= V[i+1]+1;
        if (d::odd and i=1) then pp:= pp + b^(i2-i-1) else
          pp:= pp + b^(i2-i-1) - b^(i2-i+1) fi;
      od;
      return pp, d, V
    end proc:
    count:= 1:
    S:= 0:
    p2[0]:=1: V2[0]:= <1>: d2[0]:= 1:m2:= 0:
    p10[0]:= 1: V10[0]:= <1>: d10[0]:= 1: m10:= 0:
    while count < 100 do
      i2:= min[index]([seq(p2[i],i=0..m2)])-1; p2o:= p2[i2];
      i10:= min[index]([seq(p10[i],i=0..m10)])-1; p10o:= p10[i10];
      if p2o = p10o then
        S:= S, p2o; count:= count+1;
      fi;
      if p2o <= p10o then x, d2[i2], V2[i2]:= nextpal(p2o/2^i2, d2[i2], V2[i2],2); p2[i2]:= 2^i2 *x;
        if i2 = m2 then m2:= m2+1; p2[m2]:= 2^m2; V2[m2]:= <1>; d2[m2]:= 1;
     fi;
      else
        x, d10[i10], V10[i10]:= nextpal(p10o/10^i10, d10[i10], V10[i10],10);
        p10[i10]:= 10^i10 * x;
        if i10 = m10 then m10:= m10+1; p10[m10]:= 10^m10; V10[m10]:= <1>; d10[m10]:= 1
    fi fi od:
    S; # Robert Israel, Apr 01 2024
  • Mathematica
    pal[n_, b_] := (z=IntegerDigits[n, b]) == Reverse[z]; extpal[n_, b_] := If[Mod[n, b]>0, pal[n, b], extpal[n/b, b]]; Select[Range[50000], extpal[ #, 10]&&extpal[ #, 2]&]

Extensions

Edited by Dean Hickerson, Apr 06 2002
0 inserted by Sean A. Irvine, Mar 29 2024

A225416 Number of iterations of the map n -> f(n) needed to reach 0 and starting with n, where f(n) is given by the following definition: f(n) = u(n) mod v(n) where u(n) = max (n, reverse(n)) and v(n) = min(n, reverse(n)).

Original entry on oeis.org

0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 2, 3, 2, 2, 3, 1, 2, 1, 2, 3, 2, 2, 3, 3, 2, 1, 2, 2, 1, 2, 3, 4, 5, 2, 3, 1, 3, 3, 2, 1, 2, 3, 4, 5, 3, 1, 2, 2, 3, 2, 1, 2, 3, 4, 5, 1, 3, 2, 4, 3, 2, 1, 2, 3, 4, 1, 2, 3, 5, 4, 3, 2, 1, 2, 3, 1, 2, 3, 2, 5, 4, 3
Offset: 0

Views

Author

Michel Lagneau, May 07 2013

Keywords

Comments

The fixed points are in A061917 (either a palindrome or becomes a palindrome if trailing 0's are omitted). The number of iterations needed to reach a fixed point equals a(n) - 1 with n > 0, and 0 for n = 0.
The smallest k such that a(k) = n iterations are {0, 1, 12, 14, 36, 37, 103, 118, 238, 257, 1282, 2165, 2459, 11908, 100673, 113233, 144104, 300768, 1329025, ...}, and it seems that 3*log_10(k)/n ~ 1 where n tends into infinity.
The Maple program below gives two sequences: the number of iterations of this sequence and the fixed points in increasing order (sequence A061917).

Examples

			The trajectory of 37 is 37 -> 36 -> 27 -> 18 -> 9 -> 0, so a(37) = 5. The fixed point is 9 = A061917(10).
73 mod 37 = 36, 63 mod 36 = 27, 72 mod 27 = 18, 81 mod 18 = 9 and 9 mod 9 = 0.
		

Crossrefs

Cf. A061917.

Programs

  • Maple
    lst1:={}:for n from 1 to 494 do:nn:=n:ii:=0:r:=1:lst:={n}:for it from 1 to 20 while(r<>0) do: V:=convert(nn, base, 10): n1:=nops(V):s:=0:for a from n1 by -1  to 1 do:s:=s+V[a]*10^(n1-a): od:m1:=min(nn,s):m2:=max(nn,s):r:=irem(m2,m1): lst:=lst union {r}:nn:=r: od: printf(`%d, `,it-1): lst1:=lst1 union { lst[2]}: od:print(lst1):

A233574 a(n) is the smallest term of either A233010 or A233572 such that |n-a(n)|

Original entry on oeis.org

0, 1, 2, 2, 4, 3, 4, 6, 8, 6, 6, 8, 8, 7, 12, 8, 10, 9, 10, 13, 12, 13, 16, 20, 16, 18, 26, 18, 18, 20, 18, 18, 20, 20, 18, 26, 20, 24, 26, 21, 24, 21, 26, 43, 32, 24, 28, 26, 28, 43, 30, 27, 28, 27, 28, 54, 30, 39, 40, 32, 32, 43, 32, 39, 40, 39, 40, 43, 36
Offset: 0

Views

Author

Lei Zhou, Dec 13 2013

Keywords

Comments

It is conjectured that a(n) exists for all n >= 0.

Examples

			a(19)=13 since 19=13+6=A233010(9)+A233572(3) and 13>6. There is no number in A233010 or A233572 smaller than 13 that satisfies the same condition.
		

Crossrefs

Programs

  • Mathematica
    BTDigits[m_Integer, g_] :=
    (*This is to determine digits of a number in balanced ternary notation.*)
    Module[{n = m, d, sign, t = g},
      If[n != 0, If[n > 0, sign = 1, sign = -1; n = -n];
       d = Ceiling[Log[3, n]]; If[3^d - n <= ((3^d - 1)/2), d++];
       While[Length[t] < d, PrependTo[t, 0]];
       t[[Length[t] + 1 - d]] = sign;
       t = BTDigits[sign*(n - 3^(d - 1)), t]]; t];
    BTpaleQ[n_Integer] :=
    (*This is to query if a number is an element of sequence A233010.*)
    Module[{t, trim = n/3^IntegerExponent[n, 3]},
      t = BTDigits[trim, {0}]; t == Reverse[t]];
    BTrteQ[n_Integer] :=
    (*This is to query if a number is an element of sequence A233572.*)
    Module[{t, trim = n/3^IntegerExponent[n, 3]},
      t = BTDigits[trim, {0}]; DeleteDuplicates[t + Reverse[t]] == {0}];
    sa = Select[Range[0, 30000], BTpaleQ[#] &];
    (*This is to generate a limited list of A233010.*)
    sb = Select[Range[0, 30000], BTrteQ[#] &];
    (*This is to generate a limited list of A233572.*)
    range = 68; Table[i1 = 0; i2 = 0;
    While[If[sa[[i1 + 1]] < sb[[i2 + 1]], i1++; nh = sa[[i1]]; isa = 1,
       i2++; nh = sb[[i2]]; isa = 0]; (2*nh) < n];
    While[If[isa == 0, chk = MemberQ[sa, Abs[n - nh]],
       chk = MemberQ[sb, Abs[n - nh]]]; ! chk,
      If[sa[[i1 + 1]] < sb[[i2 + 1]], i1++; nh = sa[[i1]]; isa = 1, i2++;
       nh = sb[[i2]]; isa = 0]];
    If[isa == 0, m = sb[[i2]], m = sa[[i1]]]; m, {n, 0, range}]

A233580 In balanced ternary notation, zerofree non-repdigit numbers that are either palindromes or sign reversed palindromes.

Original entry on oeis.org

2, 7, 16, 20, 32, 43, 61, 103, 124, 146, 182, 196, 292, 302, 338, 367, 421, 547, 601, 859, 913, 1039, 1096, 1172, 1280, 1312, 1600, 1640, 1748, 1816, 2560, 2624, 2732, 2776, 3064, 3092, 3200, 3283, 3445, 3823, 3985, 4759, 4921, 5299, 5461, 7663, 7825, 8203
Offset: 1

Views

Author

Lei Zhou, Dec 14 2013

Keywords

Comments

Zerofree numbers in balanced ternary notation can be used as reversible sign operators. This sequence collects such operators that are either in palindrome form or sign reversed palindrome form (which is defined as (n)_bt+Reverse((n)_bt)=0).

Examples

			2 = (1T)_bt in balanced ternary notation, where we use T to represent -1.
1T + T1 = 0, matches the definition of sign reversed palindrome form. So 2 is in the sequence.
Other examples:
7 = (1T1_bt) - palindrome; in the sequence.
13 = (111)_bt - palindrome but repdigit; not in the sequence.
16 = (1TT1)_bt - palindrome; in the sequence.
...
52 = (1T0T1)_bt - palindrome but not zerofree; not in the sequence.
		

Crossrefs

Programs

  • Mathematica
    BTDigits[m_Integer, g_] :=
    (* This is to determine digits of a number in balanced ternary notation. *)
    Module[{n = m, d, sign, t = g},  If[n != 0, If[n > 0, sign = 1,
      sign = -1; n = -n];   d = Ceiling[Log[3, n]]; If[3^d - n <= ((3^d - 1)/2), d++];   While[Length[t] < d, PrependTo[t, 0]]; t[[Length[t] + 1 - d]] = sign;   t = BTDigits[sign*(n - 3^(d - 1)), t]]; t];
    BTnum[g_]:=Module[{bo=Reverse[g],data=0,i},Do[data=data+3^(i-1)*bo[[i]],{i,1,Length[bo]}];data];
    ct=0;n=0;dg=0;spool={};res={};While[ct<50,n++; nbits = BTDigits[n, {0}];cdg=Length[nbits];If[cdg>dg,If[Length[spool]>0,Do[bits=spool[[j]];If[!MemberQ[bits,0],rb=Reverse[bits]; sign=rb[[1]];bo=Join[bits,-sign*rb];If[MemberQ[bo,-1],data=BTnum[bo];ct++;AppendTo[res,data]];bo=Join[bits,sign*rb];If[MemberQ[bo,-1],data=BTnum[bo];ct++;AppendTo[res,data]]],{j,1,Length[spool]}];Do[bits=spool[[j]];If[!MemberQ[bits,0],rb=Reverse[bits];bo=Join[bits,{-1},rb];If[MemberQ[bo,-1],data=BTnum[bo];ct++;AppendTo[res,data]];bo=Join[bits,{1},rb];If[MemberQ[bo,-1],data=BTnum[bo];ct++;AppendTo[res,data]]],{j,1,Length[spool]}];spool={};dg=cdg]];AppendTo[spool,nbits]];Print[res]

A325152 Numbers whose squares can be expressed as the product of a number and its reversal.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 20, 22, 30, 33, 40, 44, 50, 55, 60, 66, 70, 77, 80, 88, 90, 99, 100, 101, 110, 111, 121, 131, 141, 151, 161, 171, 181, 191, 200, 202, 212, 220, 222, 232, 242, 252, 262, 272, 282, 292, 300, 303, 313, 323, 330, 333, 343, 353, 363, 373, 383, 393, 400, 403, 404, 414, 424, 434
Offset: 1

Views

Author

Bernard Schott, Apr 11 2019

Keywords

Comments

The corresponding squares are in A325148 and the numbers k such that k * rev(k) is a square are in A306273.
The squares of the first 47 terms of this sequence (from 0 to 242) can be expressed as the product of a number and its reversal in only one way; then a(48) = 252 and 252^2 = 252 * 252 = 144 * 441.
The first 65 terms of this sequence (from 0 to 400) are exactly the first 65 terms of A061917; then a(66) = 403, non-palindrome, is the first term of the sequence A325151.

Examples

			One way: 20^2 = 400 = 200 * 2.
Two ways: 2772^2 = 7683984 = 2772 * 2772 = 1584 * 4851.
Three ways: 2520^2 = 14400 * 441 = 25200 * 252 = 44100 * 144.
403 is a member since 403^2 = 162409 = 169*961 (note that 403 is not a member of A281625).
		

Crossrefs

Cf. also A061917, A325151.
Similar to but different from A281625.

Formula

a(n) = sqrt(A325148(n)).
Previous Showing 11-16 of 16 results.