cirrus-uchicago/symbolon/avoid-iterative-gcd-with-mutated-params

Claude Code and agent skill by cirrus-uchicago/symbolon

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Use when GCD/LCM is computed via an iterative loop that mutates the input parameters and reuses them as both state and divisor, creating loop-carried symbolic dependencies

Install

npx vskill@latest install cirrus-uchicago/symbolon/avoid-iterative-gcd-with-mutated-params

SKILL.md

The same SKILL.md was published earlier as cirrus-uchicago/symbolon/avoid-iterative-gcd-with-mutated-params.

avoid-iterative-gcd-with-mutated-params

Overview

A KLEE-coverage code transformation. Applying it rewrites C source so symbolic execution explores more of the program's behavior.

When to use

When GCD/LCM is computed via an iterative loop that mutates the input parameters and reuses them as both state and divisor, creating loop-carried symbolic dependencies

Transformation

Replace the iterative parameter-mutating gcd loop with a clean recursive gcd(a,b) returning gcd(b, a%b), and express lcm as (a/gcd(a,b))*b using fresh local computation

Why it helps

Recursive gcd produces simpler, smaller per-call symbolic constraints (each call introduces one modulo expression) instead of a loop whose path condition accumulates compounded modulo expressions over mutated variables, letting KLEE's solver discharge queries faster and reach more downstream paths

Example

Before:

c
#include<stdio.h>
int lcm(int a,int b){
int m;
int p=a*b;
m = a%b;
while(m>0){
a = b;
b = m;
m = a%b;
}
return p/b;
}
int main(){
int n,a,b;
scanf("%d",&n);
scanf("%d %d",&a,&b);
a = lcm(a,b);
while(n>2){
scanf("%d",&b);
a = lcm(a,b);
n--;
}
printf("%d\n",a);
}

After:

c
#include <stdio.h>
int gcd(int a, int b)
{
if(b==0) return a;
return gcd(b, a%b);
}
int lcm(int a, int b)
{
return (a/gcd(a,b))*b;
}
int a[20];
int main()
{
int n, l, i;
while(scanf("%d", &n)==1){
l = 0;
scanf("%d", &a[0]);
scanf("%d", &a[1]);
l = lcm(a[0], a[1]);
for(i=2; i<n; i++){
scanf("%d", &a[i]);
l = lcm(l, a[i]);
}
printf("%d\n", l);
}
return 0;
}

Evidence

  • Average coverage delta: 0.4234
  • Source problems: train_AIZU_p02469
  • Rule id: e689ad65

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
11
7-day trend score
17

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/cirrus-uchicago/symbolon/avoid-iterative-gcd-with-mutated-params/badge)](https://verified-skill.com/skills/cirrus-uchicago/symbolon/avoid-iterative-gcd-with-mutated-params)

Something wrong with this skill or its page? Tell us.