Merge numbers to a new number and find digit on position (n)Brackets in output make unable to use output to identify matrix elementWhat does the slash-colon symbol do?Splicing a list of arguments into a function with SequenceBincounting a listimport a list of replacement rulesFinding a number which has the same remainder when dividing certain other numbersNegative accuracy numerics ( 0``-128 notation )Please explain the following code containing Partition and FlattenDifference between f[x] and f as arguments of functionsEvaluating an expression on one line

Feasible explanation to the continued existence of dangerous magical creatures in a modern setting

Convex subsets of an open set

What's objectionable about the Axiom of Countable Additivity?

Extracting solutions from ContourPlot

Name for geostationary orbit around another planet

What difference does horsepower make? If the engine can spin the propeller fast enough, why does it need power behind it?

Is a job offer letter with no mention of salary structure legal or correct?

Drawing between two nodes in Tikz

Is there any other sparse matrix data in matlab built-in file?

Rite of Winter: How to Stop Crescian Couples from Mutual Assassination

What can I do at Hong Kong Airport for 13 hours?

Can I freely use 'here is' instead of 'there is' if I'm in the place where that thing is?

Is it normal to not be able to work 8 hours a day?

Can airpod with wrong spelling on the case be original?

Why does the monotone convergence theorem not apply on Riemann integrals?

Can I travel to UK as a cabin crew after being refused entry to Ireland?

Reduction of amino acids to corresponding amino alcohols

LilyPond - change tuplet bracket to a small bow

Do fresh chilli peppers have properties that ground chilli peppers do not?

Aliens kill as an art form, surprised that humans don't appreciate

Is my visualization of a photon correct?

Can I apply for a passport in the country I'm in so I can travel to my home country?

Do the holes in Jacquard loom punched cards represent input data or program code?

How can baseline humanity survive on its own in the future?



Merge numbers to a new number and find digit on position (n)


Brackets in output make unable to use output to identify matrix elementWhat does the slash-colon symbol do?Splicing a list of arguments into a function with SequenceBincounting a listimport a list of replacement rulesFinding a number which has the same remainder when dividing certain other numbersNegative accuracy numerics ( 0``-128 notation )Please explain the following code containing Partition and FlattenDifference between f[x] and f as arguments of functionsEvaluating an expression on one line






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;

.everyonelovesstackoverflowposition:absolute;height:1px;width:1px;opacity:0;top:0;left:0;pointer-events:none;








5















$begingroup$


I'm trying to construct a 'Mathematica solution' for the following 'puzzle'




The natural numbers are placed in a row;



12345678910111213...



What digit is the 10,000th digit?




I don't know the syntax how to form this number, or to extract digit $n$ (in the example $n=10000$) in Mathematica. Anybody that can help? TIA.










share|improve this question









$endgroup$














  • $begingroup$
    Take a look at the documentation of IntegerDigits, that should solve your problem. To get enough digits, you can either try to work out exactly how many numbers you need to concatenate, or you could also just take enough (i.e. 10000) to make sure
    $endgroup$
    – Lukas Lang
    Oct 16 at 18:16










  • $begingroup$
    Flatten[IntegerDigits /@ Range[5000]][[10000]]
    $endgroup$
    – OkkesDulgerci
    Oct 16 at 19:47

















5















$begingroup$


I'm trying to construct a 'Mathematica solution' for the following 'puzzle'




The natural numbers are placed in a row;



12345678910111213...



What digit is the 10,000th digit?




I don't know the syntax how to form this number, or to extract digit $n$ (in the example $n=10000$) in Mathematica. Anybody that can help? TIA.










share|improve this question









$endgroup$














  • $begingroup$
    Take a look at the documentation of IntegerDigits, that should solve your problem. To get enough digits, you can either try to work out exactly how many numbers you need to concatenate, or you could also just take enough (i.e. 10000) to make sure
    $endgroup$
    – Lukas Lang
    Oct 16 at 18:16










  • $begingroup$
    Flatten[IntegerDigits /@ Range[5000]][[10000]]
    $endgroup$
    – OkkesDulgerci
    Oct 16 at 19:47













5













5









5





$begingroup$


I'm trying to construct a 'Mathematica solution' for the following 'puzzle'




The natural numbers are placed in a row;



12345678910111213...



What digit is the 10,000th digit?




I don't know the syntax how to form this number, or to extract digit $n$ (in the example $n=10000$) in Mathematica. Anybody that can help? TIA.










share|improve this question









$endgroup$




I'm trying to construct a 'Mathematica solution' for the following 'puzzle'




The natural numbers are placed in a row;



12345678910111213...



What digit is the 10,000th digit?




I don't know the syntax how to form this number, or to extract digit $n$ (in the example $n=10000$) in Mathematica. Anybody that can help? TIA.







syntax






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Oct 16 at 18:14









mf67mf67

6091 silver badge6 bronze badges




6091 silver badge6 bronze badges














  • $begingroup$
    Take a look at the documentation of IntegerDigits, that should solve your problem. To get enough digits, you can either try to work out exactly how many numbers you need to concatenate, or you could also just take enough (i.e. 10000) to make sure
    $endgroup$
    – Lukas Lang
    Oct 16 at 18:16










  • $begingroup$
    Flatten[IntegerDigits /@ Range[5000]][[10000]]
    $endgroup$
    – OkkesDulgerci
    Oct 16 at 19:47
















  • $begingroup$
    Take a look at the documentation of IntegerDigits, that should solve your problem. To get enough digits, you can either try to work out exactly how many numbers you need to concatenate, or you could also just take enough (i.e. 10000) to make sure
    $endgroup$
    – Lukas Lang
    Oct 16 at 18:16










  • $begingroup$
    Flatten[IntegerDigits /@ Range[5000]][[10000]]
    $endgroup$
    – OkkesDulgerci
    Oct 16 at 19:47















$begingroup$
Take a look at the documentation of IntegerDigits, that should solve your problem. To get enough digits, you can either try to work out exactly how many numbers you need to concatenate, or you could also just take enough (i.e. 10000) to make sure
$endgroup$
– Lukas Lang
Oct 16 at 18:16




$begingroup$
Take a look at the documentation of IntegerDigits, that should solve your problem. To get enough digits, you can either try to work out exactly how many numbers you need to concatenate, or you could also just take enough (i.e. 10000) to make sure
$endgroup$
– Lukas Lang
Oct 16 at 18:16












$begingroup$
Flatten[IntegerDigits /@ Range[5000]][[10000]]
$endgroup$
– OkkesDulgerci
Oct 16 at 19:47




$begingroup$
Flatten[IntegerDigits /@ Range[5000]][[10000]]
$endgroup$
– OkkesDulgerci
Oct 16 at 19:47










2 Answers
2






active

oldest

votes


















8

















$begingroup$

The number you are constructing is related to the base 10 Champernowne constant, except that the Champernowne is a real number that starts with 0.123... while your "number" is an integer with an infinite number of digits.



In Mathematica, the Champernowne constant in base 10 is given by ChampernowneNumber[]. To get the 10,000 digit, just use RealDigits:



RealDigits[ChampernowneNumber[], 10, 1, -10000][[1, 1]]



7







share|improve this answer










$endgroup$





















    1

















    $begingroup$

    A (much slower) procedural method.



    First we find the number of digits of 123...(n-1)n.



    numlength[n_] := With[
    pow = Floor@N@Log10[n],
    Range[pow].(9*10^Range[0, pow - 1]) + (pow + 1) (n - 10^pow + 1)
    ]


    Here pow = Floor@N@Log10[n] gives the order of magnitude (OoM) of n, Range[pow] and (pow + 1) gives the number of digits in each OoM and the last OoM, respectively, 9*10^Range[0, pow - 1] and (n - 10^pow + 1) gives the number of numbers in each OoM and the last OoM. So the final output is the number of digits in the number 123...(n-1)n.



    Then, because I couldn't think of a better way,



    proc[limit_] := Block[
    n = 1,
    While[numlength[n] <= limit, n++];
    If[numlength[n - 1] == limit, Mod[n - 1, 10], IntegerDigits[n][[limit - numlength[n - 1]]]]
    ]


    While it's much slower than @CarlWoll's method, and definitely not the best method, it still works.



    proc[10^4] // RepeatedTiming
    RealDigits[ChampernowneNumber[], 10, 1, -10^4][[1, 1]] // RepeatedTiming



    0.032, 7



    0.000086, 7







    share|improve this answer










    $endgroup$















      Your Answer








      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "387"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );














      draft saved

      draft discarded
















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f208013%2fmerge-numbers-to-a-new-number-and-find-digit-on-position-n%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown


























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      8

















      $begingroup$

      The number you are constructing is related to the base 10 Champernowne constant, except that the Champernowne is a real number that starts with 0.123... while your "number" is an integer with an infinite number of digits.



      In Mathematica, the Champernowne constant in base 10 is given by ChampernowneNumber[]. To get the 10,000 digit, just use RealDigits:



      RealDigits[ChampernowneNumber[], 10, 1, -10000][[1, 1]]



      7







      share|improve this answer










      $endgroup$


















        8

















        $begingroup$

        The number you are constructing is related to the base 10 Champernowne constant, except that the Champernowne is a real number that starts with 0.123... while your "number" is an integer with an infinite number of digits.



        In Mathematica, the Champernowne constant in base 10 is given by ChampernowneNumber[]. To get the 10,000 digit, just use RealDigits:



        RealDigits[ChampernowneNumber[], 10, 1, -10000][[1, 1]]



        7







        share|improve this answer










        $endgroup$
















          8















          8











          8







          $begingroup$

          The number you are constructing is related to the base 10 Champernowne constant, except that the Champernowne is a real number that starts with 0.123... while your "number" is an integer with an infinite number of digits.



          In Mathematica, the Champernowne constant in base 10 is given by ChampernowneNumber[]. To get the 10,000 digit, just use RealDigits:



          RealDigits[ChampernowneNumber[], 10, 1, -10000][[1, 1]]



          7







          share|improve this answer










          $endgroup$



          The number you are constructing is related to the base 10 Champernowne constant, except that the Champernowne is a real number that starts with 0.123... while your "number" is an integer with an infinite number of digits.



          In Mathematica, the Champernowne constant in base 10 is given by ChampernowneNumber[]. To get the 10,000 digit, just use RealDigits:



          RealDigits[ChampernowneNumber[], 10, 1, -10000][[1, 1]]



          7








          share|improve this answer













          share|improve this answer




          share|improve this answer










          answered Oct 16 at 19:03









          Carl WollCarl Woll

          98.4k4 gold badges133 silver badges247 bronze badges




          98.4k4 gold badges133 silver badges247 bronze badges


























              1

















              $begingroup$

              A (much slower) procedural method.



              First we find the number of digits of 123...(n-1)n.



              numlength[n_] := With[
              pow = Floor@N@Log10[n],
              Range[pow].(9*10^Range[0, pow - 1]) + (pow + 1) (n - 10^pow + 1)
              ]


              Here pow = Floor@N@Log10[n] gives the order of magnitude (OoM) of n, Range[pow] and (pow + 1) gives the number of digits in each OoM and the last OoM, respectively, 9*10^Range[0, pow - 1] and (n - 10^pow + 1) gives the number of numbers in each OoM and the last OoM. So the final output is the number of digits in the number 123...(n-1)n.



              Then, because I couldn't think of a better way,



              proc[limit_] := Block[
              n = 1,
              While[numlength[n] <= limit, n++];
              If[numlength[n - 1] == limit, Mod[n - 1, 10], IntegerDigits[n][[limit - numlength[n - 1]]]]
              ]


              While it's much slower than @CarlWoll's method, and definitely not the best method, it still works.



              proc[10^4] // RepeatedTiming
              RealDigits[ChampernowneNumber[], 10, 1, -10^4][[1, 1]] // RepeatedTiming



              0.032, 7



              0.000086, 7







              share|improve this answer










              $endgroup$


















                1

















                $begingroup$

                A (much slower) procedural method.



                First we find the number of digits of 123...(n-1)n.



                numlength[n_] := With[
                pow = Floor@N@Log10[n],
                Range[pow].(9*10^Range[0, pow - 1]) + (pow + 1) (n - 10^pow + 1)
                ]


                Here pow = Floor@N@Log10[n] gives the order of magnitude (OoM) of n, Range[pow] and (pow + 1) gives the number of digits in each OoM and the last OoM, respectively, 9*10^Range[0, pow - 1] and (n - 10^pow + 1) gives the number of numbers in each OoM and the last OoM. So the final output is the number of digits in the number 123...(n-1)n.



                Then, because I couldn't think of a better way,



                proc[limit_] := Block[
                n = 1,
                While[numlength[n] <= limit, n++];
                If[numlength[n - 1] == limit, Mod[n - 1, 10], IntegerDigits[n][[limit - numlength[n - 1]]]]
                ]


                While it's much slower than @CarlWoll's method, and definitely not the best method, it still works.



                proc[10^4] // RepeatedTiming
                RealDigits[ChampernowneNumber[], 10, 1, -10^4][[1, 1]] // RepeatedTiming



                0.032, 7



                0.000086, 7







                share|improve this answer










                $endgroup$
















                  1















                  1











                  1







                  $begingroup$

                  A (much slower) procedural method.



                  First we find the number of digits of 123...(n-1)n.



                  numlength[n_] := With[
                  pow = Floor@N@Log10[n],
                  Range[pow].(9*10^Range[0, pow - 1]) + (pow + 1) (n - 10^pow + 1)
                  ]


                  Here pow = Floor@N@Log10[n] gives the order of magnitude (OoM) of n, Range[pow] and (pow + 1) gives the number of digits in each OoM and the last OoM, respectively, 9*10^Range[0, pow - 1] and (n - 10^pow + 1) gives the number of numbers in each OoM and the last OoM. So the final output is the number of digits in the number 123...(n-1)n.



                  Then, because I couldn't think of a better way,



                  proc[limit_] := Block[
                  n = 1,
                  While[numlength[n] <= limit, n++];
                  If[numlength[n - 1] == limit, Mod[n - 1, 10], IntegerDigits[n][[limit - numlength[n - 1]]]]
                  ]


                  While it's much slower than @CarlWoll's method, and definitely not the best method, it still works.



                  proc[10^4] // RepeatedTiming
                  RealDigits[ChampernowneNumber[], 10, 1, -10^4][[1, 1]] // RepeatedTiming



                  0.032, 7



                  0.000086, 7







                  share|improve this answer










                  $endgroup$



                  A (much slower) procedural method.



                  First we find the number of digits of 123...(n-1)n.



                  numlength[n_] := With[
                  pow = Floor@N@Log10[n],
                  Range[pow].(9*10^Range[0, pow - 1]) + (pow + 1) (n - 10^pow + 1)
                  ]


                  Here pow = Floor@N@Log10[n] gives the order of magnitude (OoM) of n, Range[pow] and (pow + 1) gives the number of digits in each OoM and the last OoM, respectively, 9*10^Range[0, pow - 1] and (n - 10^pow + 1) gives the number of numbers in each OoM and the last OoM. So the final output is the number of digits in the number 123...(n-1)n.



                  Then, because I couldn't think of a better way,



                  proc[limit_] := Block[
                  n = 1,
                  While[numlength[n] <= limit, n++];
                  If[numlength[n - 1] == limit, Mod[n - 1, 10], IntegerDigits[n][[limit - numlength[n - 1]]]]
                  ]


                  While it's much slower than @CarlWoll's method, and definitely not the best method, it still works.



                  proc[10^4] // RepeatedTiming
                  RealDigits[ChampernowneNumber[], 10, 1, -10^4][[1, 1]] // RepeatedTiming



                  0.032, 7



                  0.000086, 7








                  share|improve this answer













                  share|improve this answer




                  share|improve this answer










                  answered Oct 17 at 2:02









                  That Gravity GuyThat Gravity Guy

                  4,1161 gold badge7 silver badges21 bronze badges




                  4,1161 gold badge7 silver badges21 bronze badges































                      draft saved

                      draft discarded















































                      Thanks for contributing an answer to Mathematica Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      Use MathJax to format equations. MathJax reference.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f208013%2fmerge-numbers-to-a-new-number-and-find-digit-on-position-n%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown









                      Popular posts from this blog

                      Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

                      Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

                      Ласкавець круглолистий Зміст Опис | Поширення | Галерея | Примітки | Посилання | Навігаційне меню58171138361-22960890446Bupleurum rotundifoliumEuro+Med PlantbasePlants of the World Online — Kew ScienceGermplasm Resources Information Network (GRIN)Ласкавецькн. VI : Літери Ком — Левиправивши або дописавши її