All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Pentagonal and Hexagonal Poser (Posted on 2022-03-10) Difficulty: 3 of 5
Let us define P(N) as the Nth Pentagonal number and H(N) as the Nth Hexagonal number.
All the positive pentagonal numbers and hexagonal numbers are now considered alternately in order, that is:
P(1), H(2), P(3), H(4), P(5), H(6),.....
Writing these without commas or spaces results in this infinite string:
             161228356670120117190......
Determine the 2022th digit in the above pattern. What is the 20220th digit in the above pattern?

*** P(N)= N(3N-1)/2, and, H(N) = N(2N-1), so that:
P(1)=1, H(2)= 6, P(3)= 12, H(4) = 28, P(5) = 35, H(6) = 66, ..... and so on

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 4
clc,clearvars
s=char.empty;
i=0;
while length(s)<2022
   i=i+1;
   if mod(i,2)==1
       p=i*(3*i-1)/2;
       s=[s char(string(p))];
   else
       h=i*(2*i-1);
       s=[s char(string(h))];
   end
end
disp([i p h])
disp([s(2022-10:end) '   ' s(2022)])
disp('          _')
s=char.empty;
i=0;
while length(s)<20220
   i=i+1;
   if mod(i,2)==1
       p=i*(3*i-1)/2;
       s=[s char(string(p))];
   else
       h=i*(2*i-1);
       s=[s char(string(h))];
   end
end
disp([i p h])
disp([s(20220-10:end) '   ' s(20220)])
disp('          _')

shows

         396      233840      313236
0078233840313236   3
         

        2968    13203150    17615080
1320315017615080   6
         
          
meaning the 3 that begins the 396th hexagonal number, 313236, is the 2022nd digit of the pattern. (233840 is the 395th pentagonal number.)

and 6 is the 20220th digit in the pattern, from the 2968th hexagonal number, 17615080, which follows 13203150, the 2967th pentagonal number.

  Posted by Charlie on 2022-03-10 09:22:40
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (6)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information