Skip to main content
1 of 2

Bash + GNU Core Utils: 80 Bytes

for i in $(seq `tee a|wc -c`)
{
grep -oE .{$i}<a|factor|grep -oP '(?<=: )\d+$'
}

This cannot be the shortest, but I am having trouble coming up with anything better. Help wanted!

By sticking to only POSIX, I got 82:

for i in $(seq `tee a|wc -c`)
{
grep -oE .{$i}<a|factor|awk -F\  'NF<3{print$2}'
}