3
$\begingroup$

While using, for example, the code

f[n_] := Plus @@ (Select[Range@n, GCD[#, n] == 1 &]^2);
a101 = Array[f, 50]
a102 = Transpose[{Range[1, 50], a101}]
Export["b053818.txt", a102, "Table"]

which is the MA code for Oeis sequence A053818. The exported data looks like:

1 1
2 1
3 5
4 10
5 30
6 26
7 91
8 84
9 159
10 140
11 385

Now, as seen, the spacing between the line indicator, first column, and the data, second column, is set to one space. The question is:

While viewing the MA code data exported in gedit the space is as seen and is one space. While viewing in Notepad and Wordpad the same space is seen as a tabbed space. How can this issue be resolved inside the MA code?

$\endgroup$
4
$\begingroup$

You can use the "FieldSeparators" option to specify what is used to separate fields:

ExportString[a102, "Table", "FieldSeparators" -> " . . . "]
1 . . . 1
2 . . . 1
3 . . . 5
4 . . . 10
5 . . . 30
6 . . . 26
7 . . . 91
8 . . . 84

I believe the default is a Tab, entered as "\t". How that is displayed by external software is a different issue.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.