I'm working on modernizing Rosetta Code's infrastructure. Starting with communications. Please accept this time-limited open invite to RC's Slack.. --Michael Mol (talk) 20:59, 30 May 2020 (UTC)

Talk:Show the (decimal) value of a number of 1s appended with a 3, then squared

From Rosetta Code

task clarification[edit]

I assume that this (draft) task is to use decimal (base ten) numbers, in particular, to use positive integers.   Also, is the showing of those numbers optional?   -- Gerard Schildberger (talk) 15:56, 5 April 2021 (UTC)


OEIS references[edit]

I suggest if you're adding (draft) Rosetta Code tasks,   to include any pertinent links to OEIS entries and other (if possible) links from such sites as Wikipedia, MathWorld, and other similar sites).     -- Gerard Schildberger (talk) 16:02, 5 April 2021 (UTC)

Is this a named sequence ?
I ran a test program to calculate 111...113 with more 1s, with 99 1s, I get:
AAAAAAAAAAA54320ZZZZZZZZZZ98769 where A=123456790 and Z=987654320. Sadly, it doesn't tend to 123456789... : )
--Tigerofdarkness (talk) 16:43, 5 April 2021 (UTC)
It isn't a   named   sequence   (per se)   in that it has no "snappy" name that rolls off the tongue,   but it does have an OEIS number:   A151997.     -- Gerard Schildberger (talk) 17:15, 5 April 2021 (UTC)
What do you suggest for task name?--CalmoSoft (talk) 06:35, 6 April 2021 (UTC)
I don't have a short name, anything that I can think of is a bit verbose, but descriptive.  
                      Show the (decimal) value of a number of  1s  appended with a  3,   then squared

(or something like that).   I'm sure someone will come up with a better, and hopefully, a shorter name.   Of course, it would be better if there was a snappy name for the series, but there ya have it.   At least, the task now has a requirement;   compute and show the results.     -- Gerard Schildberger (talk) 06:54, 6 April 2021 (UTC)

Python 'one-liner' added before earlier submissions[edit]

The new 'one-liner' Python variant is very welcome.

Normal Rosetta practice is, however, to preserve submission order – always adding new variants after existing ones, rather than

attempting to rank or prioritise – readers can be allowed to judge for themselves which version best matches their own interests and contexts.

You could either add your code to the end of one of the existing Python sections, or move your new section to the end.

You may also find it helpful to make use of a standard linter.

'One-liner' is an understandably seductive phrase, but the actual value of squeezing code onto one line is uncertain –

it's cognitive cost (reduced legibility, except in the very shortest cases) is, however, clearer.

Your first draft exceeds the usual Rosetta limit of 80 chars (also preferred by pyLint etc),

and might be more legible if rearranged into two or three lines. Hout (talk) 22:49, 4 October 2021 (UTC)

Perhaps, for example, using the slightly cleaner literal string interpolation idiom, as something like:

[
print(f'{"1" * i}3^2 = {int("1" * i + "3") ** 2}')
for i in range(0, 8)
]

Hout (talk) 23:08, 4 October 2021 (UTC)