Jump to content

Composite numbers k with no single digit factors whose factors are all substrings of k: Difference between revisions

Line 342:
 
=={{header|EasyLang}}==
{{trans|C}} (optimized)
<syntaxhighlight>
fastfunc is_substringisin n k .
pfxh = k
while n > 0
if pfxh mod 10 = n mod 10
pfxh = pfxh div 10
if startMatchmatch = 0
startMatchmatch = n
.
else
pfxh = k
if startMatchmatch <> 0
n = startMatchmatch
.
startMatchmatch = 0
.
if pfxh = 0
return 1
.
Line 366:
return 0
.
 
fastfunc facts_are_substest n .
if n mod 2 = 0 or n mod 3 = 0 or n mod 5 = 0 or n mod 7 = 0
return 0
.
factor_countrest = 0n
n_restfact = n11
factorwhile fact <= 11rest
if rest mod fact = 0
while factor <= n_rest
if n_rest while rest mod factorfact = 0
while n_rest mod factorrest /= 0fact
n_rest /= factor
.
if is_substringisin n factorfact = 0
return 0
.
factor_countnfacts += 1
.
factorfact += 2
if factorfact > sqrt n and factor_countnfacts = 0
return 0
.
.
if factor_countnfacts > 1
return 1
.
Line 394:
.
n = 11
while amountcount < 10
if facts_are_substest n = 1
print n
amountcount += 1
.
n += 2
2,056

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.