Retina 0.8.2, 73(削除) 73 (削除ここまで) 62 bytes
.+
$*
^.$|^((.)+*)(?=1円*$)(?<=..)(?<!^3円+(..+))(?!((?<-2>1円)+)(?(2)^)4円*$)
Try it online! Try it online! Link includes test cases. Outputs 0 for a Guiga number, 1 if not. Explanation:
.+
$*
Convert n to unary.
^.$|
Special-case 1, as all of its prime factors satisfy the relation but it's not composite so it's excluded.
^((.)+*)
Match an integer p=1円, but also as a count 2円, where...
(?=1円*$)
... p must be a factor of n, ...
(?<=..)
... p must be at least 2, ...
(?<!^3円+(..+))
... p must not have a nontrivial proper factor 3円, and...
(?!((?<-2>1円)+)(?(2)^)4円*$)
... n-p must be zero (in which case n is not composite) or not divisible by p2, which is calculated by matching 1円 2円 times, and then captured, so that it can be easily repeated using 4円.
Edit: Saved 11 bytes thanks to @Deadcode pointing out that I don't need to check that p is at least 2, and in fact also allowing p=0 means that the program works for n=0 (although not required by the question) at no extra cost.
Retina 0.8.2, 73 bytes
.+
$*
^.$|^((.)+)(?=1円*$)(?<=..)(?<!^3円+(..+))(?!((?<-2>1円)+)(?(2)^)4円*$)
Try it online! Link includes test cases. Outputs 0 for a Guiga number, 1 if not. Explanation:
.+
$*
Convert n to unary.
^.$|
Special-case 1, as all of its prime factors satisfy the relation but it's not composite so it's excluded.
^((.)+)
Match an integer p=1円, but also as a count 2円, where...
(?=1円*$)
... p must be a factor of n, ...
(?<=..)
... p must be at least 2, ...
(?<!^3円+(..+))
... p must not have a nontrivial proper factor 3円, and...
(?!((?<-2>1円)+)(?(2)^)4円*$)
... n-p must be zero (in which case n is not composite) or not divisible by p2, which is calculated by matching 1円 2円 times, and then captured, so that it can be easily repeated using 4円.
Retina 0.8.2, (削除) 73 (削除ここまで) 62 bytes
.+
$*
^((.)*)(?=1円*$)(?<!^3円+(..+))(?!((?<-2>1円)+)(?(2)^)4円*$)
Try it online! Link includes test cases. Outputs 0 for a Guiga number, 1 if not. Explanation:
.+
$*
Convert n to unary.
^((.)*)
Match an integer p=1円, but also as a count 2円, where...
(?=1円*$)
... p must be a factor of n, ...
(?<!^3円+(..+))
... p must not have a nontrivial proper factor 3円, and...
(?!((?<-2>1円)+)(?(2)^)4円*$)
... n-p must be zero (in which case n is not composite) or not divisible by p2, which is calculated by matching 1円 2円 times, and then captured, so that it can be easily repeated using 4円.
Edit: Saved 11 bytes thanks to @Deadcode pointing out that I don't need to check that p is at least 2, and in fact also allowing p=0 means that the program works for n=0 (although not required by the question) at no extra cost.
Retina 0.8.2, 73 bytes
.+
$*
^.$|^((.)+)(?=1円*$)(?<=..)(?<!^3円+(..+))(?!((?<-2>1円)+)(?(2)^)4円*$)
Try it online! Link includes test cases. Outputs 0 for a Guiga number, 1 if not. Explanation:
.+
$*
Convert n to unary.
^.$|
Special-case 1, as all of its prime factors satisfy the relation but it's not composite so it's excluded.
^((.)+)
Match an integer p=1円, but also as a count 2円, where...
(?=1円*$)
... p must be a factor of n, ...
(?<=..)
... p must be at least 2, ...
(?<!^3円+(..+))
... p must not have a nontrivial proper factor 3円, and...
(?!((?<-2>1円)+)(?(2)^)4円*$)
... n-p must not be zero (in which case n is not composite) or not divisible by p2, which is calculated by matching 1円 2円 times, and then captured, so that it can be easily repeated using 4円.
Retina 0.8.2, 73 bytes
.+
$*
^.$|^((.)+)(?=1円*$)(?<=..)(?<!^3円+(..+))(?!((?<-2>1円)+)(?(2)^)4円*$)
Try it online! Link includes test cases. Outputs 0 for a Guiga number, 1 if not. Explanation:
.+
$*
Convert n to unary.
^.$|
Special-case 1, as all of its prime factors satisfy the relation but it's not composite so it's excluded.
^((.)+)
Match an integer p=1円, but also as a count 2円, where...
(?=1円*$)
... p must be a factor of n, ...
(?<=..)
... p must be at least 2, ...
(?<!^3円+(..+))
... p must not have a nontrivial proper factor 3円, and...
(?!((?<-2>1円)+)(?(2)^)4円*$)
... n-p must not be divisible by p2, which is calculated by matching 1円 2円 times, and then captured, so that it can be easily repeated using 4円.
Retina 0.8.2, 73 bytes
.+
$*
^.$|^((.)+)(?=1円*$)(?<=..)(?<!^3円+(..+))(?!((?<-2>1円)+)(?(2)^)4円*$)
Try it online! Link includes test cases. Outputs 0 for a Guiga number, 1 if not. Explanation:
.+
$*
Convert n to unary.
^.$|
Special-case 1, as all of its prime factors satisfy the relation but it's not composite so it's excluded.
^((.)+)
Match an integer p=1円, but also as a count 2円, where...
(?=1円*$)
... p must be a factor of n, ...
(?<=..)
... p must be at least 2, ...
(?<!^3円+(..+))
... p must not have a nontrivial proper factor 3円, and...
(?!((?<-2>1円)+)(?(2)^)4円*$)
... n-p must be zero (in which case n is not composite) or not divisible by p2, which is calculated by matching 1円 2円 times, and then captured, so that it can be easily repeated using 4円.
Retina 0.8.2, 73 bytes
.+
$*
^.$|^((.)+)(?=1円*$)(?<=..)(?<!^3円+(..+))(?!((?<-2>1円)+)(?(2)^)4円*$)
Try it online! Link includes test cases. Outputs 0 for a Guiga number, 1 if not. Explanation:
.+
$*
Convert n to unary.
^.$|
Special-case 1, as all of its prime factors satisfy the relation but it's not composite so it's excluded.
^((.)+)
Match an integer p=1円, but also as a count 2円, where...
(?=1円*$)
... p must be a factor of n, ...
(?<=..)
... p must be at least 2, ...
(?<!^3円+(..+))
... p must not have a nontrivial proper factor 3円, and...
(?!((?<-2>1円)+)(?(2)^)4円*$)
... n-p must not be divisible by p2, which is calculated by matching 1円 2円 times, and then captured, so that it can be easily repeated using 4円.