Maybe something like this?

Update: Added full number at each end to improve visualisation of locality.

#! perl -slw use strict; sub log10{ log( $_[0] ) / log( 10 ) } sub tape { my( $start, $end ) = @_; my $n = log10( $end ); my @lines = split '', $start; for my $p ( $start + 1 .. $end -1 ) { for my $l ( 0 .. $n ) { $lines[ $n - $l ] .= $p % 10**$l ? ' ' : substr int( $p / 10**$l ), -1; } } $lines[ $_ ] .= substr $end, $_, 1 for 0 .. length( $end ) -1; unshift @lines, '-' x ( $end - $start + 1 ); push @lines, '-' x ( $end - $start ); substr $lines[ -1 ], ( $end - $start ) / 2, 0, 'v'; return @lines; } print for tape( 170, 230 ); print for tape( 1970, 2030 ); print for tape( 39_999_963, 40_000_041 ); __END__ c:\test>712774.pl ------------------------------------------------------------- 1 2 2 7 8 9 0 1 2 3 0123456789012345678901234567890123456789012345678901234567890 ------------------------------v------------------------------ ------------------------------------------------------------- 1 2 2 9 0 0 7 8 9 0 1 2 3 0123456789012345678901234567890123456789012345678901234567890 ------------------------------v------------------------------ ---------------------------------------------------------------------- +--------- 3 4 + 4 9 0 + 0 9 0 + 0 9 0 + 0 9 0 + 0 9 0 + 0 6 7 8 9 0 1 2 3 + 44 3456789012345678901234567890123456789012345678901234567890123456789012 +345678901 ---------------------------------------v------------------------------ +---------

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

In reply to Re: Vertical number representation for Turing Machine tape display? by BrowserUk
in thread Vertical number representation for Turing Machine tape display? by eric.foxx

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.