%I #75 Jan 01 2024 02:18:55
%S 12,23,34,45,56,67,78,89,910,1011,1112,1213,1314,1415,1516,1617,1718,
%T 1819,1920,2021,2122,2223,2324,2425,2526,2627,2728,2829,2930,3031,
%U 3132,3233,3334,3435,3536,3637,3738,3839,3940,4041,4142,4243,4344,4445,4546
%N a(n) = n concatenated with n + 1.
%C See A030457 for the indices of prime terms in this sequence. - _Reinhard Zumkeller_, Jun 27 2015 [Simplified by _Jianing Song_, Jan 27 2019]
%H N. J. A. Sloane, <a href="/A001704/b001704.txt">Table of n, a(n) for n = 1..25000</a> (first 1000 terms from T. D. Noe)
%p f:=proc(i) i*10^(1+floor(evalf(log10(i+1), 10)))+i+1; end: # gives a(n) - _N. J. A. Sloane_, Aug 04 2012
%p # alternative Maple program:
%p a:= n-> parse(cat(n, n+1)):
%p seq(a(n), n=1..55); # _Alois P. Heinz_, Jul 05 2018
%t Table[FromDigits@Flatten@IntegerDigits[{n, n + 1}], {n, 100}] (* _T. D. Noe_, Aug 09 2012 *)
%o (Haskell)
%o a001704 n = a001704_list !! (n-1)
%o a001704_list = map read (zipWith (++) iss $ tail iss) :: [Integer]
%o where iss = map show [1..]
%o -- _Reinhard Zumkeller_, Oct 07 2014
%o (PARI) a(n)=eval(Str(n,n+1)) \\ _Charles R Greathouse IV_, Jul 23 2016
%o (Emacs Lisp)
%o ;; Concatenation
%o (defun A001704 (n) (string-to-int (concat (int-to-string n) (int-to-string (1+ n)))))
%o ;; Formula
%o (defun A001704 (n) (1+ n (* n (expt 10 (1+ (floor (log (1+ n) 10)))))))
%o (mapcar '(lambda (n) (cons n (A001704 n))) '(1 2 3 10 11 12 99 999)) => ((1 . 12) (2 . 23) (3 . 34) (10 . 1011) (11 . 1112) (12 . 1213) (99 . 99100) (999 . 9991000))
%o ; _Tim Chambers_, Jul 07 2018
%o (Magma) [Seqint(Intseq(n+1) cat Intseq(n)): n in [1..50]]; // _Vincenzo Librandi_, Jul 08 2018
%o (Python) for n in range(1,100): print(str(n)+str(n+1)) # _David F. Marrs_, Sep 17 2018
%o (Scala) val numerStrs = (1 to 50).map(Integer.toString(_)).toList
%o val concats = (numerStrs.dropRight(1)) zip (numerStrs.drop(1))
%o concats.map(x => Integer.parseInt(x._1 + x._2)) // _Alonso del Arte_, Oct 24 2019
%Y See A127421 for a version with offset 0.
%Y Cf. A215027, A248378, A030457.
%K nonn,base,easy
%O 1,1
%A _N. J. A. Sloane_
%E More terms from _Joshua Zucker_ and _Jon E. Schoenfield_, May 15 2007
|