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.

A067030 Numbers of the form k + reverse(k) for at least one k.

Original entry on oeis.org

0, 2, 4, 6, 8, 10, 11, 12, 14, 16, 18, 22, 33, 44, 55, 66, 77, 88, 99, 101, 110, 121, 132, 141, 143, 154, 161, 165, 176, 181, 187, 198, 201, 202, 221, 222, 241, 242, 261, 262, 281, 282, 302, 303, 322, 323, 342, 343, 362, 363, 382, 383, 403, 404, 423, 424, 443
Offset: 0

Views

Author

Klaus Brockhaus, Dec 29 2001

Keywords

Comments

From Avik Roy (avik_3.1416(AT)yahoo.co.in), Feb 02 2009: (Start)
Any (k+1)-digit number m can be represented as
m = Sum_{i=0..k} (ai*10^i).
Reverse(m) = Sum_{i=0..k} (ai*10^(k-i)).
m+Reverse(m) = Sum_{i=0..k} (ai*(10^i+10^(k-i))).
The last formula can produce all the terms of this sequence; the order of terms is explicitly determined by the order of ai's (repetition of terms might not be avoided). (End)

Examples

			0 belongs to the sequence since 0 + 0 = 0;
33 belongs to the sequence since 12 + 21 = 33.
		

Crossrefs

Programs

  • ARIBAS
    function Reverse(n: integer): integer; var i: integer; str, rev: string;
    begin str := itoa(n); rev := "";
    for i := 0 to length(str)-1 do rev := concat(str[i], rev); end;
    return atoi(rev); end Reverse;
    function A067030(a, b: integer); var k, n: integer;
    begin for n := a to b do k := 0; while k <= n do
    if n = k+Reverse(k) then write(n, ", "); break; else inc(k); end;
    end; end; end A067030;
    A067030(0, 500) (* revised by Klaus Brockhaus, May 04 2011 *).
    
  • Magma
    A067030:=function(a, b); S:=[]; for n in [a..b] do k:=0; while k le n do if n eq k+Seqint(Reverse(Intseq(k))) then Append(~S, n); break; else k+:=1; end if; end while; end for; return S; end function; A067030(0, 500); // Klaus Brockhaus, May 04 2011
    
  • Mathematica
    M = 10^3; digrev[n_] := IntegerDigits[n] // Reverse // FromDigits; Clear[b]; b[A067030%20=%20Join%5B%7B0%7D,%20Reap%5BFor%5Bn%20=%201,%20n%20%3C=%20M,%20n++,%20If%5Bb%5Bn%5D%20%3E=%201,%20Sow%5Bn%5D%5D%5D%5D%5B%5B2,%201%5D%5D%5D%20(*%20_Jean-Fran%C3%A7ois%20Alcover">] = 0; For[n = 1, n <= M, n++, t1 = n + digrev[n]; If[t1 <= M, b[t1] = b[t1] + 1]]; A067030 = Join[{0}, Reap[For[n = 1, n <= M, n++, If[b[n] >= 1, Sow[n]]]][[2, 1]]] (* _Jean-François Alcover, Oct 01 2016, after N. J. A. Sloane's Maple code in A072040 *)
    max = 1000; l = ConstantArray[0, max]; Do[s = n + IntegerReverse@n; If[s <= max, l[[s]]++], {n, max}]; Flatten@{0, Position[l, ?(# != 0 &)]} (* _Hans Rudolf Widmer, Dec 25 2022 *)
  • Python
    def aupto(lim): return sorted(set(t for t in (k + int(str(k)[::-1]) for k in range(lim+1)) if t <= lim))
    print(aupto(443)) # Michael S. Branicky, Dec 25 2022

A072041 a(n) is the smallest number of the form k + reverse(k) for exactly n integers k, or -1 if no such number exists.

Original entry on oeis.org

1, 0, 22, 33, 44, 55, 66, 77, 88, 99, 1111, -1, 2552, -1, 2662, 3443, 2772, -1, 2882, -1, 2992, 3663, -1, -1, 3773, 5445, -1, 3883, 4664, -1, 3993, -1, 4774, -1, -1, 5665, 4884, -1, -1, -1, 4994, -1, 6666, -1, -1, 5885, -1, -1, 6776, 7667, 5995, -1, -1, -1, 6886
Offset: 0

Views

Author

Klaus Brockhaus, Jun 08 2002

Keywords

Comments

The negative terms are conjectural. Moreover they have a rather low degree of confirmation, since due to the time-consuming computations only numbers from 0 to 65000 have been taken into account. Random tests of larger numbers however seem to indicate, that only selected values of n occur. - In the cognate sequence A071266 two numbers a and b are counted only once, if n = a + b, a = reverse(b), b = reverse(a). Then 33 = 12 + 21 = 30 + 03 has a count of 2 and 44 = 13 + 31 = 22 + 22 = 40 + 04 has a count of 3, so 44 appears in A071266 instead of 33.
Terms are correct for k <= 10^8. - Sean A. Irvine, Aug 27 2024

Examples

			a(0) = 1, since 1 can in no way be written as k + reverse(k); a(1) = 0, since 0 = k + reverse(k) for k = 0; a(3) = 33, since 33 = k + reverse(k) for k = 12, 21 and 30.
		

Crossrefs

A096768 Numbers n of the form k + reverse(k) for two or more values of k.

Original entry on oeis.org

22, 33, 44, 55, 66, 77, 88, 99, 110, 121, 132, 143, 154, 165, 176, 187, 202, 222, 242, 262, 282, 302, 303, 322, 323, 342, 343, 362, 363, 382, 383, 403, 404, 423, 424, 443, 444, 463, 464, 483, 484, 504, 505, 524, 525, 544, 545, 564, 565, 584, 585, 605, 606
Offset: 1

Views

Author

Chuck Seggelin (seqfan(AT)plastereddragon.com), Jul 08 2004

Keywords

Examples

			22 belongs to the sequence since 11 + 11 = 22 and 20 + 2 = 22 (k = {11, 20}); 33 belongs to the sequence since 12 + 21 = 33, 21 + 12 = 33 and 30 + 3 = 33 (k = {12, 21, 30}).
		

Crossrefs

Cf. A067030, A072040 (exactly two values of k).

Programs

  • Maple
    reverse:= proc (d) local n,m; m:=0;n:=d; while n>0 do m:=m*10+(n mod 10); n:=(n-(n mod 10))/10; od; m; end; P:={};P2:={};for i to 5000 do; if i>0 then; r:=i+reverse(i); rat:={r}; if P intersect rat = {} then P:=P union rat else P2:=P2 union rat fi; fi; od; P2;
    # Maple program from N. J. A. Sloane, Mar 07 2016. Assumes digrev (from the "transforms" file) is available:
    M:=1000; b := Array(1..M,0);
    for n from 1 to M do
    t1:=n+digrev(n);
    if t1 <= M then b[t1]:=b[t1]+1; fi;
    od:
    ans:=[];
    for n from 1 to M do
    if b[n]>=2 then ans:=[op(ans),n]; fi; od:
    ans;
  • Mathematica
    M = 10^3; digrev[n_] := IntegerDigits[n] // Reverse // FromDigits; Clear[b]; b[A096768%20=%20Reap%5BFor%5Bn%20=%201,%20n%20%3C=%20M,%20n++,%20If%5Bb%5Bn%5D%20%3E=%202,%20Sow%5Bn%5D%5D%5D%5D%5B%5B2,%201%5D%5D%20(*%20_Jean-Fran%C3%A7ois%20Alcover">] = 0; For[n = 1, n <= M, n++, t1 = n + digrev[n]; If[t1 <= M, b[t1] = b[t1] + 1]]; A096768 = Reap[For[n = 1, n <= M, n++, If[b[n] >= 2, Sow[n]]]][[2, 1]] (* _Jean-François Alcover, Oct 01 2016, after N. J. A. Sloane's Maple code *)

A071914 Numbers n of the form k + reverse(k) for exactly three k.

Original entry on oeis.org

33, 176, 303, 323, 343, 363, 383, 403, 423, 443, 463, 483, 1221, 1616, 1636, 1656, 1676, 1696, 1716, 1736, 1756, 1776, 1796, 2761, 3003, 4983, 12021, 12421, 12621, 12821, 13021, 13221, 13421, 13621, 13821, 16016, 17996, 18238, 19778, 26161
Offset: 0

Views

Author

Klaus Brockhaus, Jun 13 2002

Keywords

Examples

			33 = 12 + 21 = 21 + 12 = 30 + 03, 176 = 79 + 97 = 88 + 88 = 97 + 79, 383 = 142 + 241 = 241 + 142 = 340 + 043.
		

Crossrefs

A072427 Numbers n for which there is a unique k such that n = k + reverse(k).

Original entry on oeis.org

0, 2, 4, 6, 8, 10, 11, 12, 14, 16, 18, 101, 141, 161, 181, 198, 201, 221, 241, 261, 281, 1001, 1818, 1838, 1858, 1878, 1898, 1918, 1938, 1958, 1978, 1998, 2981, 10001, 10201, 10401, 10601, 10801, 11001, 11201, 11401, 11601, 11801, 18018, 19998
Offset: 1

Views

Author

Klaus Brockhaus, Jun 17 2002

Keywords

Comments

Subsequence of A067030. First term is A072041(1). A068065 is a subsequence of this sequence.

Examples

			18 = 9 + 9; 261 = 180 + 081; 11401 = 10700 + 00701.
		

Crossrefs

Programs

  • ARIBAS
    var n,k,c,i,rev: integer; st,nst: string; end; m := 1; for n := 0 to 29000 do k := n div 2; c := 0; while k <= n and c < m + 1 do st := itoa(k); nst := ""; for i := 0 to length(st) - 1 do nst := concat(st[i],nst); end; rev := atoi(nst); if n = k + rev then inc(c); if k mod 10 <> 0 and k <> rev then inc(c); end; end; inc(k); end; if c = m then write(n,","); end; end;
  • Mathematica
    revAdd[n_] := n + FromDigits[Reverse[IntegerDigits[n]]]; ra=Table[revAdd[n], {n, 0, 10^5}]; t=Sort[Tally[ra]]; First /@ Select[t, #[[2]] == 1 && #[[1]] <= Length[ra] &]
Showing 1-5 of 5 results.