Logo

Greetings from The On-Line Encyclopedia of Integer Sequences!

Hints

Search: id:A082935
Displaying 1-1 of 1 results found. page 1
     Format: long | short | internal | text      Sort: relevance | references | number      Highlight: on | off
A082935 Smallest palindrome beginning with n and a digit sum of n at some stage. +0
1
1, 2, 3, 4, 5, 6, 7, 8, 9, 10801, 11711, 12621, 13531, 14441, 15351, 16261, 17171, 1881, 1949999999999999999999491, 208802, 2139312, 227722, 2329232, 246642, 2519152, 265562, 27972, 28882, 29792, 3088803, 3179713, 3278723, 3369633, 3468643 (list; graph; listen)
OFFSET

1,2

COMMENT

In most cases (perhaps in all other) except for n = 19 the digit sum in the first round itself is n. In case of 19 the first round of digit sum is 199 and the second round digit sum is 19.

EXAMPLE

a(19)=1949999999999999999999491. The smallest such number is 194 followed by 19 nines followed by 491. The first digit sum would be 199 and the next sum is 19.

MATHEMATICA

(*This code works for all numbers up to 100 except 19*) NextPalindrome[n_] := Block[{l = Floor[Log[10, n] + 1], idn = IntegerDigits[n]}, If[ Union[idn] == {9}, Return[n + 2], If[l < 2, Return[n + 1], If[ FromDigits[ Reverse[ Take[idn, Ceiling[l/2]]]] FromDigits[ Take[idn, -Ceiling[l/2]]], FromDigits[ Join[ Take[idn, Ceiling[l/2]], Reverse[ Take[idn, Floor[l/2]]]]], idfhn = FromDigits[ Take[idn, Ceiling[l/2]]] + 1;

idp = FromDigits[ Join[ IntegerDigits[idfhn], Drop[ Reverse[ IntegerDigits[ idfhn]], Mod[l, 2]]]]]]]]; f[n_] := Block[{k = 1, dn = IntegerDigits[n]}, sdn = 2*Plus @@ dn; If[sdn == 2n, n, If[sdn == n, FromDigits[ Join[dn, Reverse[dn]]], If[sdn > n, 0, k = 10^Floor[(n - sdn)/9] - 1; ; While[Plus @@ IntegerDigits[k] + sdn != n, k = NextPalindrome[k]]; FromDigits[ Join[dn, IntegerDigits[k], Reverse[dn]]]]]]]; Table[ f[n], {n, 1, 35}]

CROSSREFS

Cf. A082217.

Adjacent sequences: A082932 A082933 A082934 this_sequence A082936 A082937 A082938

Sequence in context: A135385 A087051 A082217 this_sequence A077739 A078213 A032555

KEYWORD

base,nonn

AUTHOR

Meenakshi Srikanth (menakan_s(AT)yahoo.com), Apr 16 2003

EXTENSIONS

Edited, corrected and extended by Robert G. Wilson v (rgwv(AT)rgwv.com), Jun 27 2003

Checked the conjecture above to n=100 - Robert G. Wilson v.

page 1

Search completed in 0.002 seconds

Lookup | Welcome | Find friends | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
More pages | Superseeker | Maintained by N. J. A. Sloane (njas@research.att.com)

Last modified October 7 14:39 EDT 2008. Contains 144666 sequences.


AT&T Labs Research