[go: up one dir, main page]

login
Concatenation of numbers from n down to 1.
68

%I #87 Feb 19 2023 16:26:42

%S 1,21,321,4321,54321,654321,7654321,87654321,987654321,10987654321,

%T 1110987654321,121110987654321,13121110987654321,1413121110987654321,

%U 151413121110987654321,16151413121110987654321,1716151413121110987654321,181716151413121110987654321

%N Concatenation of numbers from n down to 1.

%C The first prime term in this sequence is a(82) (see A176024). - _Artur Jasinski_, Mar 30 2008

%C For n < 10^4, a(n)/A000217(n) is an integer for n = 1, 2, and 18. The integers are 1, 7 (prime), and 1062667552123515268933651, respectively. - _Derek Orr_, Sep 04 2014

%D F. Smarandache, "Properties of the Numbers", University of Craiova Archives, 1975; Arizona State University Special Collections, Tempe, AZ

%H T. D. Noe, <a href="/A000422/b000422.txt">Table of n, a(n) for n = 1..150</a>

%H R. W. Stephan, <a href="http://www.ark.in-berlin.de/sm.pdf">Factors and primes in two Smarandache sequences</a>

%H Bertrand Teguia Tabuguia, <a href="https://arxiv.org/abs/2201.07127">Explicit formulas for concatenations of arithmetic progressions</a>, arXiv:2201.07127 [math.CO], 2022.

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/ConsecutiveNumberSequences.html">Consecutive Number Sequences</a>

%H <a href="/index/Mo#MWP">Index entries for sequences related to Most Wanted Primes video</a>

%F a(n+1) = (n+1)*10^len(a(n)) + a(n), where len(k) = number of digits in k.

%F a(n) = Sum_{k=1..n} k*10^(A058183(k) - (1+floor(log10(k)))). - _Alexander Goebel_, Mar 07 2020

%F From _Serge Batalov_, Dec 08 2021: (Start)

%F a(n) = ((n*9-1)*10^n+1)/9^2 for n < 10,

%F a(n) = ((n*99-1)*10^(2*n-19)-89)/99^2*10^10 + (8*10^10+1)/9^2 for 10 <= n < 100,

%F a(n) = ((n*999-1)*10^(3*n-299)-989)/999^2*10^191 + c2 for 10^2 <= n < 10^3,

%F a(n) = ((n*9999-1)*10^(4*n-3999)-9989)/9999^2*10^2892 + c3 for 10^3 <= n < 10^4,

%F a(n) = ((n*99999-1)*10^(5*n-49999)-99989)/99999^2*10^38893 + c4 for 10^4 <= n < 10^5,

%F a(n) = ((n*999999-1)*10^(6*n-599999)-999989)/999999^2*10^488894 + c5 for 10^5 <= n < 10^6,

%F where

%F c2 = (98*10^191 + 879*10^10 + 121)/99^2 = a(99),

%F c3 = (998*10^2701 - 989)/999^2*10^191 + c2 = a(999),

%F c4 = (9998*10^36001 - 9989)/9999^2*10^2892 + c3 = a(9999),

%F c5 = (99998*10^450001 - 99989)/99999^2*10^38893 + c4 = a(99999).

%F (End)

%p a[1]:= 1:

%p for n from 2 to 100 do

%p a[n]:= n*10^(1+ilog10(a[n-1])) + a[n-1]

%p od:

%p seq(a[n],n=1..100); # _Robert Israel_, Sep 05 2014

%p # second Maple program:

%p a:= proc(n) a(n):= `if`(n=1, 1, parse(cat(n, a(n-1)))) end:

%p seq(a(n), n=1..22); # _Alois P. Heinz_, Jan 12 2021

%t b = {}; a = {}; Do[w = RealDigits[n]; w = First[w]; Do[PrependTo[a, w[[Length[w] - k + 1]]], {k, 1, Length[w]}]; p = FromDigits[a]; AppendTo[b, p], {n, 1, 30}]; b (* _Artur Jasinski_, Mar 30 2008 *)

%t Table[FromDigits[Flatten[IntegerDigits/@Range[n,1,-1]]],{n,20}] (* _Harvey P. Dale_, Jul 06 2019 *)

%o (PARI) a(n)=my(t=n);forstep(k=n-1,1,-1,t=t*10^#Str(k)+k);t \\ _Charles R Greathouse IV_, Jul 15 2011

%o (PARI) A000422(n,p=1,L=1)=sum(k=1,n,k*p*=L+(k==L&&!L*=10)) \\ _M. F. Hasler_, Nov 02 2016

%o (Python)

%o def a(n): return int("".join(map(str, range(n, 0, -1))))

%o print([a(n) for n in range(1, 19)]) # _Michael S. Branicky_, Dec 08 2021

%Y Cf. A007908, A058183, A104759, A116504, A116505, A138789, A138790, A138793.

%Y See A176024 for primes.

%K nonn,base

%O 1,2

%A R. Muller

%E Edited by _N. J. A. Sloane_, Dec 03 2021