My userid is 100664. In binary this is 11000100100111000
.
An interesting property of this number is that it can be created entirely by concatenating strings which are repeated at least twice:
11 000 100100 111 000
The first few such numbers are \$3,7,10,12,15,24,28,31,36,40,42, 43, 45,48,51,53,54,56,58,60,63,80,87,96,99,103,112,115,117,120,122,124,127\$ (let me know if I've missed any as I worked these out by hand).
Your challenge is to calculate these. (Leading zeros don't count, e.g. 9 = 001001
is not part of the sequence.)
As with all sequence challenges, you may either:
- Take a number \$n\$ and output the nth term
- Take a number \$n\$ and output the first n terms
- Take no input and output these forever
Here's a reference implementation courtesy of Bubbler
Scoring
This is code-golf, shortest wins!
Testcases
These are 0-indexed.
0 => 3
1 => 7
3 => 12
5 => 24
10 => 42
15 => 53
20 => 63
25 => 103
1001
cannot be formed by concatenating strings repeated twice or more (i.e. does not match the regex^((.+)\2+)+$
).11
is not1 1
, but just11
which contains one string that has1
repeated twice. \$\endgroup\$