login

Revision History for A066122

(Bold, blue-underlined text is an addition; faded, red-underlined text is a deletion.)

Showing all changes.
In base 2, one 'Reverse and Add' step is needed to reach a palindrome.
(history; published version)
#9 by Jon E. Schoenfield at Sat Jul 11 00:08:48 EDT 2015
STATUS

editing

approved

#8 by Jon E. Schoenfield at Sat Jul 11 00:08:46 EDT 2015
COMMENTS

The analogue analog of A065206 in base 2. The number of steps starts at 0, so palindromes (cf. A006995) are excluded.

LINKS

Harry J. Smith, <a href="/A066122/b066122.txt">Table of n, a(n) for n=1,...,1000</a>

PROG

(PARI) Rev(x)= { local(d, r=0); while (x>0, d=x%10; x\=10; r=r*10 + d); return(r) } digitsIn(x)= { local(d); if (x==0, return(1)); d=1 + log(x)\log(10); if (10^d == x, d++, if (10^(d-1) > x, d--)); return(d) } Palin(x)= { local(d, e, f, i, t, y); if (x==0, return(1)); y=x; d=digitsIn(x); t=10^(d - 1); for (i=1, d\2, f=y-10*(y\10); y\=10; e=x\t; x-=t*e; t/=10; if (e!=f, return(0)) ); return(1) } baseE(x, b)= { local(d, e=0, f=1); while (x>0, d=x-b*(x\b); x\=b; e+=d*f; f*=10); return(e) } baseI(x, b)= { local(d, e=0, f=1); while (x>0, d=x-10*(x\10); x\=10; e+=d*f; f*=b); return(e) } { n=0; for (m=1, 10^9, b=baseE(m, 2); r=Rev(b); d=baseI(r, 2) + m; b=baseE(d, 2); if (Palin(b), write("b066122.txt", n++, " ", m); if (n==1000, return)) ) } [From _\\ _Harry J. Smith_, Feb 01 2010]

CROSSREFS
STATUS

approved

editing

#7 by Russ Cox at Fri Mar 30 17:27:34 EDT 2012
AUTHOR

_Klaus Brockhaus (klaus-brockhaus(AT)t-online.de), _, Dec 08 2001

Discussion
Fri Mar 30
17:27
OEIS Server: https://oeis.org/edit/global/145
#6 by Russ Cox at Fri Mar 30 17:24:35 EDT 2012
PROG

(PARI) Rev(x)= { local(d, r=0); while (x>0, d=x%10; x\=10; r=r*10 + d); return(r) } digitsIn(x)= { local(d); if (x==0, return(1)); d=1 + log(x)\log(10); if (10^d == x, d++, if (10^(d-1) > x, d--)); return(d) } Palin(x)= { local(d, e, f, i, t, y); if (x==0, return(1)); y=x; d=digitsIn(x); t=10^(d - 1); for (i=1, d\2, f=y-10*(y\10); y\=10; e=x\t; x-=t*e; t/=10; if (e!=f, return(0)) ); return(1) } baseE(x, b)= { local(d, e=0, f=1); while (x>0, d=x-b*(x\b); x\=b; e+=d*f; f*=10); return(e) } baseI(x, b)= { local(d, e=0, f=1); while (x>0, d=x-10*(x\10); x\=10; e+=d*f; f*=b); return(e) } { n=0; for (m=1, 10^9, b=baseE(m, 2); r=Rev(b); d=baseI(r, 2) + m; b=baseE(d, 2); if (Palin(b), write("b066122.txt", n++, " ", m); if (n==1000, return)) ) } [From _Harry J. Smith (hjsmithh(AT)sbcglobal.net), _, Feb 01 2010]

EXTENSIONS

OFFSET changed from 0,1 to 1,1 by _Harry J. Smith (hjsmithh(AT)sbcglobal.net), _, Feb 01 2010

Discussion
Fri Mar 30
17:24
OEIS Server: https://oeis.org/edit/global/133
#5 by Russ Cox at Sun Jul 10 18:23:05 EDT 2011
LINKS

<a href="/Sindx_index/Res.html#RAA">Index entries for sequences related to Reverse and Add!</a>

Discussion
Sun Jul 10
18:23
OEIS Server: https://oeis.org/edit/global/78
#4 by N. J. A. Sloane at Thu Nov 11 07:34:06 EST 2010
LINKS

Harry J. Smith, <a href="/A066122/b066122.txt">Table of n, a(n) for n=1,...,1000</a>

<a href="/Sindx_Res.html#RAA">Index entries for sequences related to Reverse and Add!</a>

KEYWORD

base,nonn,new

#3 by N. J. A. Sloane at Tue Jun 01 03:00:00 EDT 2010
OFFSET

0,1,1

LINKS

Harry J. Smith, <a href="b066122.txt">Table of n, a(n) for n=1,...,1000</a>

PROG

(PARI) Rev(x)= { local(d, r=0); while (x>0, d=x%10; x\=10; r=r*10 + d); return(r) } digitsIn(x)= { local(d); if (x==0, return(1)); d=1 + log(x)\log(10); if (10^d == x, d++, if (10^(d-1) > x, d--)); return(d) } Palin(x)= { local(d, e, f, i, t, y); if (x==0, return(1)); y=x; d=digitsIn(x); t=10^(d - 1); for (i=1, d\2, f=y-10*(y\10); y\=10; e=x\t; x-=t*e; t/=10; if (e!=f, return(0)) ); return(1) } baseE(x, b)= { local(d, e=0, f=1); while (x>0, d=x-b*(x\b); x\=b; e+=d*f; f*=10); return(e) } baseI(x, b)= { local(d, e=0, f=1); while (x>0, d=x-10*(x\10); x\=10; e+=d*f; f*=b); return(e) } { n=0; for (m=1, 10^9, b=baseE(m, 2); r=Rev(b); d=baseI(r, 2) + m; b=baseE(d, 2); if (Palin(b), write("b066122.txt", n++, " ", m); if (n==1000, return)) ) } [From Harry J. Smith (hjsmithh(AT)sbcglobal.net), Feb 01 2010]

KEYWORD

base,nonn,new

EXTENSIONS

OFFSET changed from 0,1 to 1,1 by Harry J. Smith (hjsmithh(AT)sbcglobal.net), Feb 01 2010

#2 by N. J. A. Sloane at Fri Feb 27 03:00:00 EST 2009
LINKS

<a href="http://www.research.att.com/~njas/sequences/Sindx_Res.html#RAA">Index entries for sequences related to Reverse and Add!</a>

KEYWORD

base,nonn,new

#1 by N. J. A. Sloane at Fri May 16 03:00:00 EDT 2003
NAME

In base 2, one 'Reverse and Add' step is needed to reach a palindrome.

DATA

2, 4, 6, 8, 10, 12, 14, 16, 18, 24, 30, 32, 34, 36, 38, 40, 42, 48, 52, 56, 62, 64, 66, 68, 70, 80, 82, 96, 100, 102, 112, 114, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 160, 162, 168, 170, 176, 178, 192, 196, 198, 200, 204, 208, 212, 224

OFFSET

0,1

COMMENTS

The analogue of A065206 in base 2. The number of steps starts at 0, so palindromes (cf. A006995) are excluded.

LINKS

<a href="http://www.research.att.com/~njas/sequences/Sindx_Res.html#RAA">Index entries for sequences related to Reverse and Add!</a>

PROG

(ARIBAS): function b2revadd_steps(k, stop: integer); var c, n, m, steps, rev: integer; begin n := 0; c := 0; while c < stop do m := n; rev := b2reverse(m); steps := 0; while steps < k and m <> rev do m := m + rev; rev := b2reverse(m); inc(steps); end; if steps = k and m = rev then write(n, " "); inc(c); end; inc(n); end; end; b2revadd_steps(1, 66).

CROSSREFS
KEYWORD

base,nonn

AUTHOR

Klaus Brockhaus (klaus-brockhaus(AT)t-online.de), Dec 08 2001

STATUS

approved