login
A224752
a(1)=1; thereafter a(n) = smallest number m such that a(n-1)+m = (a(n-1) followed by the leading digit of m).
10
1, 10, 99, 899, 8099, 72898, 656088, 5904797, 53143178, 478288606, 4304597458, 38741377125, 348672394128, 3138051547155, 28242463924397, 254182175319575, 2287639577876177, 20588756200885595, 185298805807970356, 1667689252271733205, 15009203270445598846, 135082829434010389615
OFFSET
1,2
COMMENTS
The sequence is infinite: a(n) always exists.
One could start with a(0) = 0, followed by the given a(n). - M. F. Hasler, Oct 10 2019
REFERENCES
Eric Angelini, Postings to the Sequence Fans Mailing List, Apr 13 2013
LINKS
Eric Angelini, Magic Sums
E. Angelini, Magic Sums [Cached copy, with permission]
EXAMPLE
1+10=11 < 1+1 >
10+99=109 < 10+9 >
99+899=998 < 99+8 >
899+8099=8998 < 899+9 >
8099+72898=80997 < 8099+7 >
...
MATHEMATICA
leadingDigit[x_] := IntegerPart[N[x/10^IntegerPart[Log[10, x]]]];
successor[x_] :=(
y = 1;
If[leadingDigit[z = 9x+y] == y, z,
y = leadingDigit[9x];
If[leadingDigit[z = 9x+y] == y, z,
y += 1;
If[leadingDigit[z = 9x+y] == y, z,
Print["Bug"]]]]);
(* Gilles Esposito-Farèse, Apr 21 2013 *)
PROG
(PHP) <?
/*
calcul de la suite telle que la somme
s(n) + s(n+1) s'obtient en concaténant le
premier chiffre de s(n+1) après s(n).
Eric Angelini, 18/04/2013
*/
function leading_digit ($n) {
return (int) substr("$n", 0, 1) ;
}
function successor ($n) {
$p = 9*$n ;
for ( $a = 1 ; $a <= 9 ; $a++ ) {
if (leading_digit($p+$a) == $a) {
return ($p+$a) ;
}
}
die("nothing found for successor($n)") ;
}
$x = $_REQUEST["x"] ;
$n = $_REQUEST["n"] ;
if ( $n === "0" ) {
for ($i=1 ; $i<=$x ; $i++) {
echo "$i &rarr; ", successor($i), "<br>\n" ;
}
} else {
if (! $x) $x = 1 ;
if (! $n) $n = 15 ;
while ($n--) {
echo "$x, " ;
$x = successor($x) ;
}
}
/* Eric Angelini, Apr 21 2013 */
?>
From M. F. Hasler, Oct 10 2019: (Start)
(PARI) A224752_vec(N=30)=vector(N, n, N=A224752_nxt((n>1)*N))
A224752_nxt(x, n=0)={x*=9; while(digits(x++)[1]!=n++, ); x} \\ (End)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Apr 21 2013
STATUS
approved