Smarandache sequences

A very simple number sequence is n(0)=2, n(1)=23, n(2)=235, n(3)=2357, n(4)=235711, n(5)=23571113 where n(i+1) is the i+1 prime concatenated with n(i). So n(1) = concat(2, n(0)) = 23. This is called by many as the Smarandache sequence.

Maxima code for this is,
smarandache(n):=block([p:0,l:""],
for i:0 thru n step 1 do (p:next_prime(p),l:concat(l,p)),l);

A related but different sequence, which is equally genuine is where n(i) is concatenated with the i+1 prime, the first terms are,
n(0)=2, n(1)=32, n(2)=532, n(3)=7532, n(4)=117532, and n(5)=13117532
where n(i+1) is n(i) concatenated with the i+1 prime.

I call this the Samrandache sequence. Maxima code for this is,
samrandache(n):=block([p:0,l:""],
for i:0 thru n step 1 do (p:next_prime(p),l:concat(p,l)),l);

This sequence depends on the number base. Here it is with base 10, our familiar number system. It is easy to change the number base in Maxima by setting obase. So, the sequence in binary,
(%i28) obase:2;
(%o11100) 10
(%i11101) smarandache(5);
(%o11101) 101110111110111101

Or in Octal,
(%i37) smarandache(5);
(%o37) 23571315

Or in Hexadecimal,
(%i21) smarandache(5);
(%o21) 23570B0D

Another cool sequence is the addictive Recaman sequence which looks at the link Recaman sequence or in the link OEIS

Nick's Tip Jar

support my videos and blogging

Leave a comment

Your email address will not be published. Required fields are marked *