login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A067030 Numbers of the form k + reverse(k) for at least one k. 52

%I #48 Jan 14 2023 08:44:52

%S 0,2,4,6,8,10,11,12,14,16,18,22,33,44,55,66,77,88,99,101,110,121,132,

%T 141,143,154,161,165,176,181,187,198,201,202,221,222,241,242,261,262,

%U 281,282,302,303,322,323,342,343,362,363,382,383,403,404,423,424,443

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

%C From Avik Roy (avik_3.1416(AT)yahoo.co.in), Feb 02 2009: (Start)

%C Any (k+1)-digit number m can be represented as

%C m = Sum_{i=0..k} (ai*10^i).

%C Reverse(m) = Sum_{i=0..k} (ai*10^(k-i)).

%C m+Reverse(m) = Sum_{i=0..k} (ai*(10^i+10^(k-i))).

%C 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)

%H T. D. Noe, <a href="/A067030/b067030.txt">Table of n, a(n) for n = 0..1000</a>

%H <a href="/index/Res#RAA">Index entries for sequences related to Reverse and Add!</a>

%e 0 belongs to the sequence since 0 + 0 = 0;

%e 33 belongs to the sequence since 12 + 21 = 33.

%t M = 10^3; digrev[n_] := IntegerDigits[n] // Reverse // FromDigits; Clear[b]; b[_] = 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 *)

%t 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 *)

%o (ARIBAS)

%o function Reverse(n: integer): integer; var i: integer; str, rev: string;

%o begin str := itoa(n); rev := "";

%o for i := 0 to length(str)-1 do rev := concat(str[i], rev); end;

%o return atoi(rev); end Reverse;

%o function A067030(a, b: integer); var k, n: integer;

%o begin for n := a to b do k := 0; while k <= n do

%o if n = k+Reverse(k) then write(n, ", "); break; else inc(k); end;

%o end; end; end A067030;

%o A067030(0, 500) (* revised by _Klaus Brockhaus_, May 04 2011 *).

%o (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

%o (Python)

%o def aupto(lim): return sorted(set(t for t in (k + int(str(k)[::-1]) for k in range(lim+1)) if t <= lim))

%o print(aupto(443)) # _Michael S. Branicky_, Dec 25 2022

%Y Cf. A033865, A067031, A067032, A067033, A067034, A056964.

%K base,easy,nonn

%O 0,2

%A _Klaus Brockhaus_, Dec 29 2001

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 26 19:52 EDT 2024. Contains 373723 sequences. (Running on oeis4.)